原来的代码70分求解

P1046 [NOIP2005 普及组] 陶陶摘苹果

_hsr_ @ 2023-12-05 21:18:56

#include<iostream>
#include<cmath>
using namespace std;
int a[15];
int main()
{
int b,B,A;
for(int i=1;i<=10;i++)
cin>>a[i];
cin>>b;
B=b+30;
int c=0;
for(int i=1;i<=9;i++)
{
if(a[i]<=B)  
c++ ;
}
cout<<c;
return 0;
}

by wangzixiao12345 @ 2023-12-05 21:47:35

#include<iostream>
#include<cmath>
using namespace std;
int a[15];
int main()
{
int b,B,A;
for(int i=1;i<=10;i++)
cin>>a[i];
cin>>b;
B=b+30;
int c=0;
for(int i=1;i<=10;i++)
{
if(a[i]<=B)  
c++ ;
}
cout<<c;
return 0;
}

by yu2012 @ 2023-12-17 20:18:55

for语句


by D2306dengxiangqi @ 2023-12-24 16:45:41

@hsr ```cpp

include<bits/stdc++.h>

using namespace std; int n,a[11],ans; int main() { for(int i=1;i<=10;i++) { cin>>a[i]; } cin>>n; for(int i=1;i<=10;i++) { if(a[i]<=n+30) { ans++; } } cout<<ans; return 0; }


by D2306dengxiangqi @ 2023-12-24 16:47:41

include<bits/stdc++.h>

using namespace std; int n,a[11],ans; int main() { for(int i=1;i<=10;i++) { cin>>a[i]; } cin>>n; for(int i=1;i<=10;i++) { if(a[i]<=n+30) { ans++; } } cout<<ans; return 0; }```

include<bits/stdc++.h>

using namespace std; int n,a[11],ans; int main() { for(int i=1;i<=10;i++) { cin>>a[i]; } cin>>n; for(int i=1;i<=10;i++) { if(a[i]<=n+30) { ans++; } } cout<<ans; return 0; }


|