結果
問題 |
No.784 「,(カンマ)」
|
ユーザー |
![]() |
提出日時 | 2019-04-13 01:02:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 406 bytes |
コンパイル時間 | 607 ms |
コンパイル使用メモリ | 56,792 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 06:32:30 |
合計ジャッジ時間 | 1,404 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 3 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:12:28: warning: ‘i’ may be used uninitialized in this function [-Wmaybe-uninitialized] 12 | if ((i != 0) && (i % 3 == 0)) { | ~~^~~
ソースコード
#include <iostream> #include <string> int main() { int i, j, n; std::string ans; std::cin >> n; while (true) { j = n % 10; n /= 10; ans = std::to_string(j) + ans; if ((i != 0) && (i % 3 == 0)) { ans = "," + ans; } i += 1; if (n <= 0) { break; } } std::cout << ans << std::endl; return 0; }