結果
| 問題 |
No.192 合成数
|
| コンテスト | |
| ユーザー |
158b
|
| 提出日時 | 2015-05-24 11:22:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 410 bytes |
| コンパイル時間 | 440 ms |
| コンパイル使用メモリ | 58,156 KB |
| 最終ジャッジ日時 | 2024-11-14 19:03:48 |
| 合計ジャッジ時間 | 1,095 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘bool check(int)’:
main.cpp:11:25: error: ‘sqrt’ was not declared in this scope
11 | for(int i=2; i<=sqrt(a); i++){
| ^~~~
ソースコード
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <vector>
#include <numeric>
using namespace std;
bool check(int a){
for(int i=2; i<=sqrt(a); i++){
if(a % i == 0){
return true;
}
}
return false;
}
int main(){
int n;
cin >> n;
for(int i=n-100; i<n+100; i++){
if(check(i)){
cout << i << endl;
break;
}
}
return 0;
}
158b