結果
問題 |
No.312 置換処理
|
ユーザー |
![]() |
提出日時 | 2015-12-05 03:04:48 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 833 bytes |
コンパイル時間 | 1,408 ms |
コンパイル使用メモリ | 160,652 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-14 14:17:25 |
合計ジャッジ時間 | 2,572 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 38 WA * 7 |
ソースコード
#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" #define rep(i,n) for(int i = 0;i < n;i++) #define REP(i,n,k) for(int i = n;i < k;i++) #define P(p) cout<<(p)<<endl; #define pi 3.1415926535 using namespace std; typedef long long ll; int dx[] = { 0, 1, 0, -1 }; int dy[] = { -1, 0, 1, 0 }; unsigned long long sttoi(std::string str) { unsigned long long ret; std::stringstream ss; ss << str; ss >> ret; return ret; } bool isPrime(ll n){ if (n % 2 == 0)return false; for (ll i = 3; i <= sqrt(n); i += 2){ if (n%i == 0){ return false; } } return true; } void solve(){ ll n; cin >> n; if (isPrime(n)){ cout << n << endl; return; } else{ for (ll i = 3; i <= sqrt(n); i++){ if (n%i == 0){ cout << i << endl; return; } } } } int main() { solve(); return 0; }