hedw1gP @ 2017-08-16 16:36:27
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
int a1,a2,a3,a4,a5,a6,a7,a8,a9,a0;
cin >> a0;
cin >> a1;
cin >> a2;
cin >> a3;
cin >> a4;
cin >> a5;
cin >> a6;
cin >> a7;
cin >> a8;
cin >> a9;
int max;
cin >> max;
max += 30;
int sum =0;
if (max >= a0)sum++;
if (max >= a1)sum++;
if (max >= a2)sum++;
if (max >= a3)sum++;
if (max >= a4)sum++;
if (max >= a5)sum++;
if (max >= a6)sum++;
if (max >= a7)sum++;
if (max >= a8)sum++;
if (max >= a9)sum++;
cout << sum;
return 0;
}
by OOmega @ 2017-08-16 17:44:57
#include <iostream>
using namespace std;
int main(){
int a1,a2,a3,a4,a5,a6,a7,a8,a9,a0;
cin >> a0
a1 a2 a3 a4 a5 a6 a7 a8 a9;
int max; cin >> max; max += 30; int sum =0; sum+= + (max >= a0) + (max >= a1) + (max >= a2) + (max >= a3) + (max >= a4) + (max >= a5) + (max >= a6) + (max >= a7) + (max >= a8) + (max >= a9); cout << sum; return 0; }
正解get @ ycwei982
by OOmega @ 2017-08-16 17:45:17
@ycwei982
by return先生 @ 2017-08-16 21:28:19
噗嗤,楼上的,其实没必要那么麻烦!!
瞧:
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int g,f=0,p[10];
for(int h=0;h<=9;h++)
{
p[h]=0;
}
for(int e=1;e<=10;e++)
{
cin>>p[e];
}
cin>>g;
for(int q=1;q<=10;q++)
{
if(p[q]<=g+30)
{
f++;
}
}
cout<<f;
return 0;
}
by 胖叽猪羊君 @ 2017-08-27 15:33:11
为什么拒绝数组呢?嗯哼?
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[11],n,g=0;
for(int i=1;i<=10;i++)
{
cin>>a[i];
}
cin>>n;
n+=30;
for(int j=1;j<=10;j++)
{
if(n>=a[j]) g++;//因为碰到就算摘到,所以用>=
}
cout<<g;
return 0;
}
by 2589872786lnj @ 2017-09-08 23:26:33
返璞归真
by yy233 @ 2017-09-09 13:59:04
using namespace std;
int main(){int i=0,s=0,a[10],n;for(;i<=9;++i)cin>>a[i];cin>>n;n+=30;for(i=0;i<=9;++i)if(a[i]<=n)s++;cout<<s<<endl;return 0;}
//还有谁能比我短
by yy233 @ 2017-09-09 14:00:06
@yy233 173b