結果
問題 | No.1237 EXP Multiple! |
ユーザー |
![]() |
提出日時 | 2020-09-26 00:24:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 653 bytes |
コンパイル時間 | 1,803 ms |
コンパイル使用メモリ | 192,196 KB |
最終ジャッジ日時 | 2025-01-14 21:47:44 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%ld", &n); | ~~~~~^~~~~~~~~~~ main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%ld", &a[i]); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> #define REP(i,b,e) for(int i=b;i<e;i++) using ll = int_fast64_t; const ll MOD = 1e9+7; int main(){ ll n; scanf("%ld", &n); ll a[n], zero = 0, huge = 0; REP(i, 0, n){ scanf("%ld", &a[i]); if(a[i]==0) zero++; if(a[i]>3) huge++; } if(zero) puts("-1"); else if(huge) printf("%ld\n", MOD); else{ ll ans = 1; REP(i, 0, n){ if(a[i]==2) ans *= 4; if(a[i]==3) ans *= 729; if(ans>MOD){ printf("%ld\n", MOD); return 0; } } printf("%ld\n", MOD%ans); } return 0; }