fangwenjie9294 @ 2018-08-19 17:56:29
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,a1,a2,a3,a4,a5,a6,a7,a8,a9,n,x;
cin>>a>>a1>>a2>>a3>>a4>>a5>>a6>>a7>>a8>>a9;
cin>>x;
if(x+30<=a){
n=n+1;
}
if(x+30<=a1){
n=n+1;
}
if(x+30<=a2){
n==n+1;
}
if(x+30<=a3){
n==n+1;
}
if(x+30<=a4){
n==n+1;
}
if(x+30<=a5){
n==n+1;
}
if(x+30<=a6){
n==n+1;
}
if(x+30<=a7){
n==n+1;
}
if(x+30<=a8){
n==n+1;
}
if(x+30<=a9){
n==n+1;
}
cout<<n<<endl;
return 0;
}
by 览遍千秋 @ 2018-08-19 17:58:05
所有的<=改成>=
by Cynthia_Huang @ 2019-07-14 13:59:39
不用a1,a2啊 直接用数组+循环好啦 下面是代码
using namespace std; int main() { int n,s=0; int a[10]={0}; for(int i=0;i<10;i++) { cin>>a[i]; } cin>>n; n=n+30; for(int i=0;i<10;i++) { if(n>=a[i]) { s++; } } cout<<s; return 0; }
by Cynthia_Huang @ 2019-07-14 14:00:54
当然,你那种也行..........有点复杂