結果
| 問題 |
No.784 「,(カンマ)」
|
| コンテスト | |
| ユーザー |
Kura
|
| 提出日時 | 2019-02-13 22:05:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 569 bytes |
| コンパイル時間 | 471 ms |
| コンパイル使用メモリ | 59,480 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 11:14:58 |
| 合計ジャッジ時間 | 1,067 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 2 |
ソースコード
#include<iostream>
#include<vector>
using namespace std;
int main() {
int a;
cin >> a;
int b = 1;
int c = a;
for (;c>=1000;) {
c /= 1000;
b++;
}
vector<int> d(b);
for (int i = 0; i < b; i++) {
d[i] = a % 1000;
a /= 1000;
}
for (int i = b-1; i >= 1; i--) {
if (i!=b-1&&d[i] < 10) {
cout << "00" << d[i] << ",";
}else if (i != b - 1&&d[i] < 100) {
cout << 0 << d[i] << ",";
}else {
cout << d[i] << ",";
}
}
if (d[0] < 10) {
cout << "00" << d[0] ;
}
else if (d[0] < 100) {
cout << 0 << d[0];
}
else {
cout << d[0]<<endl;
}
}
Kura