結果
問題 |
No.1816 MUL-DIV Game
|
ユーザー |
|
提出日時 | 2022-01-22 12:53:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 519 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 43,752 KB |
最終ジャッジ日時 | 2025-01-27 14:47:40 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:15:37: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | for(int i = 0; i < N; ++i) scanf("%d", A + i); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include<cstdio> #include<algorithm> using namespace std; using ll = long long; using ull = unsigned long long; int main(){ int N; scanf("%d", &N); if(N > 1 && (N&1)){ printf("1\n"); return 0; } int A[N]; for(int i = 0; i < N; ++i) scanf("%d", A + i); if(N == 1) printf("%d\n", A[0]); else if(N == 2) printf("%d\n", A[0]*A[1]); else{ nth_element(A,A+2,A+N); printf("%d\n", A[0] >= 1000000000/A[1] ? A[2] : min(A[0]*A[1], A[2])); } return 0; }