Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
120888 鲁博睿 判断质数(使用while循环) C++ Compile Error 0 MS 0 KB 430 2025-06-01 15:51:57

Tests(0/0):


Code:

#include <bits/stdc++.h> ? #include<cmath>//数学头文件 using namespace std; int main() { int n; int flag=1; //提前假设 cin>>n; //验证假设 for(int i=2;i<=sprt(n);i++){ //缩短遍历范围,提高程序速度 if(n%i==0){ //存在其他因子 flag = 0; //假设不成立 } } //输出结果 if(flag==1){ cout<<"Yes"<<endl; } else{ cout<<"No"<<endl; } return 0; }


Run Info:

Main.cc:1:26: warning: extra tokens at end of #include directive
 #include  ?
                          ^
Main.cc: In function 'int main()':
Main.cc:10:23: error: 'sprt' was not declared in this scope
  for(int i=2;i<=sprt(n);i++){  //缩短遍历范围,提高程序速度 
                       ^