結果
問題 | No.192 合成数 |
ユーザー |
![]() |
提出日時 | 2016-02-27 12:14:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 298 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 54,364 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 01:54:33 |
合計ジャッジ時間 | 1,430 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 < 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; }