結果
問題 | No.637 X: Yet Another FizzBuzz Problem |
ユーザー |
![]() |
提出日時 | 2019-08-20 14:07:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 502 bytes |
コンパイル時間 | 658 ms |
コンパイル使用メモリ | 73,788 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-06 12:05:29 |
合計ジャッジ時間 | 1,874 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:19:58: warning: 'B' may be used uninitialized [-Wmaybe-uninitialized] 19 | if (A % 3 != 0 && A % 5 != 0)cnt += B; | ~~~~^~~~ main.cpp:10:13: note: 'B' was declared here 10 | int B; | ^
ソースコード
#include<iostream> #include<algorithm> #include <vector> #include<cmath> using namespace std; typedef long long int lont; int main() { int cnt = 0; int A; int B; for (int ia = 0; ia < 5; ia++) { cin >> A; if (1 <= A&&A <= 9)B = 1; if (10 <= A && A <= 99)B = 2; if (100 <= A && A <= 999)B = 3; if (A % 3 == 0 && A % 5 == 0)cnt += 8; if (A % 3 == 0 && A % 5 != 0)cnt += 4; if (A % 3 != 0 && A % 5 == 0)cnt += 4; if (A % 3 != 0 && A % 5 != 0)cnt += B; } cout << cnt << endl; }