Neil_Seniorious @ 2022-10-05 14:24:03
https://www.luogu.com.cn/record/list?pid=P1046&user=577683
#include<bits/stdc++.h>
using namespace std;
//inline int read(){
// short f=1;int x=0;char c=getchar();
// while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
// while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48);c=getchar();}
// return x*f;
//}
int n=10;
int apple[15];
int taotao;
int ans;
int main(){
for(int i=1;i<=n;i++){
// apple[i]=read();
scanf("%d",apple+i);
}
// taotao=read();
scanf("%d",&taotao);
taotao+=30;
for(int i=1;i<=n;i++){
if(taotao>=apple[i]) ans++;
}
return printf("%d",ans);
}
//最后一遍的代码
by RNTBW @ 2022-10-05 14:34:04
用
scanf("%d",&apple[i]);
逝逝
by Neil_Seniorious @ 2022-10-05 14:36:14
@RNtianbowen https://www.luogu.com.cn/record/88693052很遗憾没有什么卵用。
by Strelitzia_ @ 2022-10-05 14:39:30
return printf("%d",ans);
改成 return printf("%d",ans),0;
试一下。
by HotDogSeller @ 2022-10-05 14:41:18
@Neil_Seniorious
return printf("%d",ans);
我真是头一次遇见这种写法......
根据RE错误信息,
写成这样:
printf("%d",ans);
return 0;
by liumuyvan @ 2022-10-05 14:46:53
你的return是不能return一个式子的 改为:
printf("%d",ans);
return 0;
就对了
by Strelitzia_ @ 2022-10-05 15:02:22
return
应该可以接式子?我一直写
return printf(/*something*/),0;
没有问题。
by SunsetLake @ 2022-10-05 15:07:52
@Strelitzia_ 他是没有加
,0
所以返回的是printf的值
by yaoqichen @ 2022-10-05 15:08:50
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[10],b,c=0,d;
for(d=0;d<=9;d++)
{
cin>>a[d];
}
cin>>b;
b+=30;
for(d=0;d<=9;d++)
{
if(b>=a[d])c++;
}
cout<<c;
return 0;
}
by yaoqichen @ 2022-10-05 15:09:17
不用这么麻烦
by Strelitzia_ @ 2022-10-05 15:10:33
@CW_gjy 啊那确实(((