結果
問題 |
No.637 X: Yet Another FizzBuzz Problem
|
ユーザー |
|
提出日時 | 2018-02-23 13:46:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 745 bytes |
コンパイル時間 | 1,531 ms |
コンパイル使用メモリ | 165,780 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 18:58:54 |
合計ジャッジ時間 | 2,441 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> #define rep(i,a,n) for (int i = a;i < n;i++) #define per(i,n,a) for (int i = n-1;i >= a;i--) using namespace std; int a[10]; int main() { rep(i, 0, 5) { cin >> a[i]; } int c = 0; rep(i, 0, 5) { if (a[i] % 3 == 0 && a[i] % 5 == 0) { c += 8; } else if ((a[i] % 3 == 0 && a[i] % 5 != 0) || (a[i] % 3 != 0 && a[i] % 5 == 0)) { c += 4; } else if (a[i] % 3 != 0 && a[i] % 5 != 0) { if (1 <= a[i] && a[i] <= 9) { c += 1; } else if (10 <= a[i] && a[i] <= 99) { c += 2; } else if (100 <= a[i] && a[i] <= 999) { c += 3; } } } cout << c << endl; }