結果
問題 |
No.784 「,(カンマ)」
|
ユーザー |
![]() |
提出日時 | 2019-12-04 15:44:20 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 382 bytes |
コンパイル時間 | 1,217 ms |
コンパイル使用メモリ | 29,056 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 15:43:31 |
合計ジャッジ時間 | 1,808 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 10 |
ソースコード
#include <stdio.h> #include <string.h> int main() { char s[16], buf[16]={'\0'}; scanf("%s", s); size_t size = strlen(s)-1; int j=0; for (int i=size; i>=0; i--, j++) { if ((j+1)%4==0 && i!=size) { buf[j++]=','; buf[j]=s[i]; } else { buf[j]=s[i]; } } for (int i=j; i>=0; i--) { printf("%c", buf[i]); } printf("\n"); return 0; }