結果
| 問題 |
No.192 合成数
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2016-02-27 12:15:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 302 bytes |
| コンパイル時間 | 379 ms |
| コンパイル使用メモリ | 54,368 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 01:54:39 |
| 合計ジャッジ時間 | 1,420 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int composite(int)’:
main.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
11 | }
| ^
ソースコード
#include <iostream>
using namespace std;
bool divisor(int x){
for(int i = 2;i * i < x;i++) if(!(x % i)) return true;
return false;
}
int composite(int x){
for(int i = x - 100;i <= x + 100;i++) if(divisor(i)) return i;
}
int main(){
int n;
cin >> n;
cout << composite(n) << endl;
}
ldsyb