Submission #00116


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int n;
int main(){
int i,j,temp=0,ans=0,e,len=0,o,w=0;
char s[1024][1024],buff[1024];
while(1){
temp=0;
ans=0;
w=0;
len=0;
fgets(buff,sizeof(buff),stdin);
sscanf(buff,"%d",&n);
if(n==0){
break;
}
for(i=0;i<n;i++){
fgets(buff,sizeof(buff),stdin);
sscanf(buff,"%s",s[i]);
temp=strlen(s[i]);
if(temp>len){
len=temp;
}
}
temp=0;
if(len==1){
temp=atoi(s[0]);
}
ans=temp;
temp=0;
// printf("%d\n",ans);
for(;len>1;len--){
for(i=0;i<n;i++){
if(strlen(s[i])==(len-1) && (s[i][strlen(s[i])-1]=='+' || s[i][strlen(s[i])-1]=='*')){
for(j=i+1;j<n;j++){
w=0;
if(strlen(s[j])==len){
temp=s[j][strlen(s[j])-1]-'0';
if(0<=temp && temp<=9){
if(s[i][strlen(s[i])-1]=='+'){
ans+=temp;
}else if(s[i][strlen(s[i])-1]=='*'){
if(w==0){
ans++;
}
ans*=temp;
}
}
}
}
}
}
}
printf("%d\n",ans);
}
return(0);
}

ステータス

項目 データ
問題 0003 - ICPC計算機
ユーザー名 yuu
投稿日時 2016-03-30 15:59:01
言語 C
状態 Wrong Answer
得点 0
ソースコード長 1175 Byte
最大実行時間 13 ms
最大メモリ使用量 380 KB

セット

セット 得点 Cases
1 ALL 0 / 20 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
C1 WA 10 ms 380 KB
1
C2 WA 11 ms 380 KB
1
C3 WA 12 ms 332 KB
1
C4 WA 13 ms 336 KB
1