結果
| 問題 |
No.369 足し間違い
|
| コンテスト | |
| ユーザー |
ReERishun
|
| 提出日時 | 2020-05-18 05:51:16 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 782 bytes |
| コンパイル時間 | 249 ms |
| コンパイル使用メモリ | 29,952 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-01 21:53:39 |
| 合計ジャッジ時間 | 688 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
ソースコード
#include<stdio.h>
void rr_scanl(int index, int *numBox) {
char str;
for (int i = 0; i<index; i++)
numBox[i] = 0;
int cnt = 0;
int mode = 0;
while (cnt < index) {
str = getchar();
if (str == '\n') {
if (cnt != 0)
break;
}
else if (str < '0' || str > '9') {
if (str == '-')
mode = 1;
else {
mode = 0;
cnt++;
}
}
else {
if(mode == 0)
numBox[cnt] = numBox[cnt] * 10 + (int)str - (int)'0';
else
numBox[cnt] = numBox[cnt] * 10 - ((int)str - (int)'0');
}
}
}
int main() {
int yukiAns = 0;
int ans = 0;
int num = 0;
int unit[10000];
scanf("%d", &num);
rr_scanl(num, unit);
scanf("%d", &yukiAns);
for (int i = 0; i < num; i++)
ans += unit[i];
printf("%d", ans - yukiAns);
// 終了コードは0
return 0;
}
ReERishun