結果
| 問題 | No.371 ぼく悪いプライムじゃないよ |
| コンテスト | |
| ユーザー |
mizzsig
|
| 提出日時 | 2016-12-01 10:47:09 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 391 bytes |
| 記録 | |
| コンパイル時間 | 623 ms |
| コンパイル使用メモリ | 84,224 KB |
| 実行使用メモリ | 9,728 KB |
| 最終ジャッジ日時 | 2026-05-21 21:38:32 |
| 合計ジャッジ時間 | 3,926 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 10 WA * 6 TLE * 1 -- * 25 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:2:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:28:10:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:11:19: note: 'ans' was declared here
11 | long long ans;
| ^~~
ソースコード
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
long long l, h;
cin >> l >> h;
long long ans;
long long so = 0;
if(l % 2 == 0){
l++;
}
for(long long i = l; i <= h; i += 2){
for(long long j = 2; j < i; j++){
if(i % j == 0){
if(so < j){
ans = i;
so = j;
}
break;
}
}
}
cout << ans << endl;
return 0;
}
mizzsig