結果
問題 | No.809 かけ算 |
ユーザー | ohreitetsu |
提出日時 | 2019-04-12 21:51:57 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 505 ms |
コンパイル使用メモリ | 67,436 KB |
実行使用メモリ | 4,352 KB |
最終ジャッジ日時 | 2023-10-12 19:49:59 |
合計ジャッジ時間 | 1,134 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,352 KB |
testcase_01 | AC | 1 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,352 KB |
testcase_03 | AC | 2 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,352 KB |
testcase_06 | AC | 1 ms
4,348 KB |
ソースコード
#include <iostream> #include <math.h> using namespace std; typedef long long LL; int IsPrime (LL n) { int i; if (n < 2){ return 0; }else if (n == 2){ return 1; } if (n % 2 == 0){ return 0; } double sqrtNum = sqrt((double)n); for (i = 3; i <= sqrtNum; i += 2){ if (n % i == 0 ){ return 0; } } return 1; } int main(int argc, char* argv[]) { LL C,i; cin>>C; if (C>2){ if (IsPrime(C) == 1){ cout<<1<<" "<<C<<endl; return 0; } } for (i=2;i<C;i++){ if (C%i==0){ cout<<i<<" "<<C/i<<endl; return 0; } } cout<<1<<" "<<C<<endl; return 0; }