結果
問題 |
No.375 立方体のN等分 (1)
|
ユーザー |
![]() |
提出日時 | 2017-08-11 20:28:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 519 bytes |
コンパイル時間 | 1,412 ms |
コンパイル使用メモリ | 166,048 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 20:44:28 |
合計ジャッジ時間 | 2,315 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 WA * 19 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main(){ | ^~~~ main.cpp: In function 'int main()': main.cpp:18:17: warning: 'A[1]' may be used uninitialized [-Wmaybe-uninitialized] 18 | if(A[1] % i == 0){ | ~~~~~^~~ main.cpp:7:10: note: 'A[1]' was declared here 7 | ll N,A[3],cnt; | ^ main.cpp:24:17: warning: 'A[0]' may be used uninitialized [-Wmaybe-uninitialized] 24 | cout << A[0]+A[1]+A[2]-3 << " " << N-1 << endl; | ~~~~^~~~~ main.cpp:7:10: note: 'A[0]' was declared here 7 | ll N,A[3],cnt; | ^
ソースコード
#include<bits/stdc++.h> typedef long long ll; using namespace std; int INF = 1e9; int MOD = 1e9+7; main(){ ll N,A[3],cnt; cin >> N; for(cnt = 1;cnt*cnt*cnt <= N;cnt++){} for(ll i = cnt;i >= 1;i--){ if(N % i == 0){ A[0] = i; A[1] = N / i; break; } } for(ll i = cnt;i >= 1;i--){ if(A[1] % i == 0){ A[2] = i; A[1] = A[1] / i; break; } } cout << A[0]+A[1]+A[2]-3 << " " << N-1 << endl; }