茶狮 @ 2019-04-03 17:36:49
楼主过于蒟蒻以至于拉低洛谷整体水平
以下代码WA(输出为10),求大佬看看如何修复QWQ
#include <iostream>
#include <cstdio>
using namespace std;
char a[15];
int main(){
int height = 0,m,ans = 0;//m-meter
for(int i = 1;i <= 10;i++)
cin >> a[i];
cin >> height;
height += 30;
for(int i = 1;i <= 10;i++){
if(height >= a[i]){
ans++;
}
}
cout << ans << endl;
return 0;
}
by milu @ 2019-04-03 17:39:55
数组类型开错了吧,不是char型的而是Int
by sss7020 @ 2019-04-03 17:40:33
char?
by sss7020 @ 2019-04-03 17:41:43
m没有使用过
by 茶狮 @ 2019-04-03 17:42:52
@milu @Albert1412 AC了感谢大佬们
果然我还是个蒟蒻QAQ
by 隋晓轩 @ 2019-04-03 17:54:23
果然我还------------是个蒟蒻QAQ
by 退役の鱼 @ 2019-04-07 18:24:53
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,e,f,g,h,i,j,hand,apple=0;
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
cin>>hand;
if(hand+30>=a)apple++;
if(hand+30>=b)apple++;
if(hand+30>=c)apple++;
if(hand+30>=d)apple++;
if(hand+30>=e)apple++;
if(hand+30>=f)apple++;
if(hand+30>=g)apple++;
if(hand+30>=h)apple++;
if(hand+30>=i)apple++;
if(hand+30>=j)apple++;
cout<<apple;
}
有没有更优解
by 陌屿 @ 2019-04-29 21:33:30
#include<stdio.h>
#include<iostream>
using namespace std;
int a[15],n,i,count;
int main()
{
for(i=1;i<=10;i++)
cin>>a[i];
cin>>n;
for(i=1;i<=10;i++)
if(n+30>=a[i])
count++;
cout<<count;
}
嗷呜哇