Zzz_hc @ 2024-05-12 17:01:03
为什么是0分?
#include <bits/stdc++.h>
using namespace std;
int main(){
int a[10],x,n=0;
for(int i=0;i<10;i++){
cin>>a[i];
cin>>x;
x+=30;
}
for(int j=0;j<10;j++){
if(x>a[j]){
n++;
}
}
cout<<n;
return 0;
}
感觉没错。
by sdyzpf @ 2024-05-12 17:05:32
@zhongjiarun666 cin>>x,x+=30你写循环里面了
by xxfnm @ 2024-05-12 22:15:59
11行应改为x>=a[j]
cin>>x,x+=30在循环外面
by Zzz_hc @ 2024-05-18 08:34:30
还是WA
#include <bits/stdc++.h>
using namespace std;
int main(){
int a[10],x,n=0;
cin>>x;
x+=30;
for(int i=0;i<10;i++){
cin>>a[i];
}
cin>>x;
x+=30;
for(int j=0;j<10;j++){
if(x>=a[j]){
n++;
}
}
cout<<n;
return 0;
}
by NullPointerExpection @ 2024-05-18 15:20:39
@zhongjiarun666 不是,哥们,两个"cin >> x"是几个意思
by Zzz_hc @ 2024-05-23 20:36:09
@NullPointerExpection
哦哦,谢谢
by Zzz_hc @ 2024-05-23 20:41:05
谢谢dalao
AC了
#include <bits/stdc++.h>
using namespace std;
int main(){
int a[10],x,n;
for(int i=0;i<10;i++){
cin>>a[i];
}
cin>>x;
x+=30;
for(int j=0;j<10;j++){
if(x>=a[j]){
n++;
}
}
cout<<n;
return 0;
}