提交记录 #5
提交时间:2024-10-29 16:47:54
语言:c
状态:CompileError
编译情况:编译错误
code.c: In function ‘main’:
code.c:21:46: error: expected ‘;’ before ‘}’ token
21 | printf("作死啊!!!!!!")
| ^
| ;
22 | }
| ~
固定测试点暂不可用
附加测试点暂不可用
M12【期中测验1】2. 简单算法-生活费
#include<stdio.h>
#include<stdbool.h>
#include<math.h>
bool isprime(int num){
if (num<=1){
return false;
}
for(int i=2;i<=sqrt(num);i++){
if (num%i==0){
return false;
}
}
return true;
}
int main(){
int a;
int b,c;
scanf("%d %d %d",&a,&b,&c);
int x1=0,x2=0;
if(a>80||b>80){
printf("作死啊!!!!!!")
}
else{
for(int i=2;i<=a;i++){
if(isprime(i)){
x1+=i;}else{x1+=0;
}
}
for(int j=2;j<=b;j++){ if(isprime(j)){
x2+=j;}else{x2+=0;
}
}
c=10*(x1+x2)/2;
printf("%d\n",c);}
return 0;
}