-
Notifications
You must be signed in to change notification settings - Fork 0
/
PAT basic
71 lines (60 loc) · 1 KB
/
PAT basic
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
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;
string s;
bool func(){
int i;
if (s.size()<23)return 0;
for (i=2;i<=21;i++)
if(s[i] !='9')return 0;
while (i<s.size())
if(s[i++] !='0')return 1;
return 0;
}
int main(){
int T; cin>>T;
while(cin>>s)
cout<<(func()?"yes":"no")<<"\n";
return 0;
}
...................................
...................................
a+b 2
#include <stdio.h>
int main(){
int a,b,n;
scanf("%d",&n);
while(n--){
scanf("%d %d",&a,&b);
printf("%d\n",a+b);
}
return 0;
}
.......................................
A+B 3
#include <stdio.h>
int main(){
int a,b;
while(scanf("%d %d",&a,&b)!=EOF){
if(a==0&b==0)
break;
printf("%d\n",a+b);
} return 0;
}
.....................
A+B 4
#include <stdio.h>
int main(){
int n,x,sum;
while(scanf("%d",&n)&&n!=0){
sum=0;
while(n--){
scanf("%d",&x);
sum+=x;
}
printf("%d\n",sum);
}
return 0;
}