結果
問題 |
No.637 X: Yet Another FizzBuzz Problem
|
ユーザー |
![]() |
提出日時 | 2018-06-11 23:44:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 485 bytes |
コンパイル時間 | 1,247 ms |
コンパイル使用メモリ | 160,132 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 13:46:40 |
合計ジャッジ時間 | 2,390 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, const char**)’: main.cpp:20:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wformat=] 20 | printf("%d\n", str.size()); | ~^ ~~~~~~~~~~ | | | | int std::__cxx11::basic_string<char>::size_type {aka long unsigned int} | %ld
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) int main(int argc, char const *argv[]) { int a[5]; rep(i, 5) cin >> a[i]; string str = ""; rep(i, 5) { if (a[i] % 15 == 0) str += "FizzBuzz"; else if (a[i] % 3 == 0) str += "Fizz"; else if (a[i] % 5 == 0) str += "Buzz"; else str += to_string(a[i]); } // cout << str << endl; printf("%d\n", str.size()); return 0; }