結果

問題 No.656 ゴルフ
ユーザー sasa
提出日時 2025-03-17 10:12:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 27,392 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-17 10:12:50
合計ジャッジ時間 1,068 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%s",num);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
	char num[10];
	scanf("%s",num);
	int total = 0;
	for(int i = 0;i < 9;i ++){
		int intNum = num[i] - '0'; 
		if(num[i] == '0'){
			total += 10;
		}else{
			total += intNum;
		}
	}
	printf("%d",total);
}
0