結果
問題 |
No.637 X: Yet Another FizzBuzz Problem
|
ユーザー |
|
提出日時 | 2018-04-30 21:36:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 386 ms |
コンパイル使用メモリ | 59,492 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 19:03:53 |
合計ジャッジ時間 | 1,201 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int calc_keta(int v){ // 1 <= v <= 999 if (v / 100 > 0){ return 3; }else if (v / 10 > 0){ return 2; } return 1; } int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); int N=5; int ans = 0; for(int i=0;i<N;i++){ int a; bool isout= false; cin >> a; if(a % 3 == 0){ // Fizz 4 ans += 4; isout = true; } if(a % 5 == 0){ // Buzz 4 ans += 4; isout = true; } if(!isout){ ans += calc_keta(a); } } cout << ans << endl; return 0; }