回答編集履歴

2

変更

2017/07/15 04:19

投稿

A.Ichi
A.Ichi

スコア4070

test CHANGED
@@ -1,4 +1,4 @@
1
- cで作成してみました。
1
+ cで作成してみました。line数を使います。
2
2
 
3
3
  ```c
4
4
 

1

変更

2017/07/15 04:19

投稿

A.Ichi
A.Ichi

スコア4070

test CHANGED
@@ -6,31 +6,29 @@
6
6
 
7
7
  #include <string.h>
8
8
 
9
- #include <ctype.h>
10
-
11
9
 
12
10
 
13
11
  void main(void ) {
14
12
 
15
- char buff[1001];
13
+ char buff[1001];
16
14
 
17
- int l, t;
15
+ int l, t;
18
16
 
19
- l=0;
17
+ l=0;
20
18
 
21
- t=0;
19
+ t=0;
22
20
 
23
- while (fgets( buff, sizeof(buff), stdin)){
21
+ while (fgets( buff, sizeof(buff), stdin)){
24
22
 
25
- t += buff[l]-'0';
23
+ t += buff[l]-'0';
26
24
 
27
- if (isdigit(buff[l+1])) t += buff[l+1]-'0';
25
+ if (buff[l+1] >='0' && buff[l+1] <='9') t += buff[l+1]-'0';
28
26
 
29
- l++;
27
+ l++;
30
28
 
31
- }
29
+ }
32
30
 
33
- printf("ttl:%d\n",t);
31
+ printf("ttl:%d\n",t);
34
32
 
35
33
  }
36
34