結果
問題 | No.656 ゴルフ |
ユーザー |
|
提出日時 | 2018-03-30 19:48:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 247 bytes |
コンパイル時間 | 1,301 ms |
コンパイル使用メモリ | 22,400 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-26 00:43:40 |
合計ジャッジ時間 | 741 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:17: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[10]’ [-Wformat=] 9 | scanf("%s", &S); | ~^ ~~ | | | | | char (*)[10] | char* main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%s", &S); | ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h> #define NUM 9 int main(void) { char S[NUM+1]; int i; int sum=0; scanf("%s", &S); for (i = 0; i < NUM; i++) { if (S[i] == '0') { sum += 10; } else { sum += S[i]-'0'; } } printf("%d\n", sum); return 0; }