結果

問題 No.784 「,(カンマ)」
コンテスト
ユーザー Maeda
提出日時 2025-03-11 13:13:59
言語 C
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 316 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 124 ms
コンパイル使用メモリ 38,208 KB
最終ジャッジ日時 2026-02-22 13:13:17
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <string.h>

int main(void){
	char n[100] = "a";
	scanf("%s",n);
	int count = 3 - (int)strlen(n)%3;
	if(count == 3){
		count = 0;
	}

	for(int i = 0 ; i < (int)strlen(n);i++){
		printf("%c",n[i]);
		count++;
		if(count == 3 && i != (int)strlen(n)-1){
			printf(",");
			count = 0;
		}
	}
}
0