![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT乙级
dayL_W
热爱编程、热爱生活、热爱运动
展开
-
1015. 德才论 (25)
#include#includelong fun(char *str,int d,int len){int i;int result=0;for(i=0;i<len;i++){if(str[i]==d+'0'){result=d+result*10;}}return result;}int main(){char str1[11],str2[11];int da原创 2017-05-13 20:02:29 · 167 阅读 · 0 评论 -
1048. 数字加密(20)
#include#includevoid swap(char *a, char *b){ char temp=*a; *a = *b; *b = temp;}int main(){ char A[200]={0},B[200]={'0'},temp=0; char password[13] = {'0','1','2','3','4','5','6','7','8'原创 2017-05-13 20:22:15 · 170 阅读 · 0 评论 -
1047. 编程团体赛(20)
//1047. 编程团体赛(20)#include #include #include using namespace std;int main(){ int N=0,i=0,team_num,member_num,score,team_score[1000]={0},max_score=0,max_team,team_all=0; scanf("%d",&N); wh原创 2017-05-13 20:21:43 · 161 阅读 · 0 评论 -
1046. 划拳(15)
#includeint main(){ int N=0,A1=0,A2=0,B1=0,B2=0,A_drink=0,B_drink=0,flag=0; scanf("%d",&N); while(N--) { scanf("%d %d %d %d",&A1,&A2,&B1,&B2); if(A2 == (A1+B1) && B2 != (A1+B1))原创 2017-05-13 20:21:10 · 160 阅读 · 0 评论 -
1044. 火星数字(20)
#include#include#includechar low[13][5]={"tret","jan","feb","mar","apr","may","jun","jly","aug","sep","oct","nov","dec"};char high[13][5]={"0","tam","hel","maa","huh","tou","kes","hei","elo","syy原创 2017-05-13 20:19:55 · 140 阅读 · 0 评论 -
1043. 输出PATest(20)
#include#includeusing namespace std;int main(){ int ch[255]={0}; char temp=0,flag=1; while((temp = getchar())!='\n') { if(temp=='P'||temp=='A'||temp=='T'||temp=='e'||temp=='s'||temp=原创 2017-05-13 20:19:20 · 124 阅读 · 0 评论 -
1042. 字符统计(20)
//1042. 字符统计(20)#include#includeusing namespace std;int main(){ char ch[255]={0},temp=0,max_char=0,i; int max_num=0,add=0; while((temp = getchar())!='\n') { ch[temp] += 1; } for原创 2017-05-13 20:18:52 · 98 阅读 · 0 评论 -
1041. 考试座位号(15)
#includeusing namespace std;struct PAT{ char num[15]; int set_try; int set_exam;};int main(){ struct PAT *stu; int N=0,M=0,i=0,temp=0; scanf("%d",&N); stu = (struct PAT *)mallo原创 2017-05-13 20:18:21 · 128 阅读 · 0 评论 -
1040. 有几个PAT(25)
#include#include#define Mod 1000000007int main(){ char input[100001]={0}; int Num_T=0,Num_AT=0,Num_PAT=0,i,len=0; scanf("%s",input); len = strlen(input); for(i=len-1; i>=0; i--) {原创 2017-05-13 20:17:44 · 126 阅读 · 0 评论 -
1039. 到底买不买(20)
//1039. 到底买不买(20)#include#includeint main(){ int ch[255]={0},more=0,lack=0,temp=0,flag=0,i=0; char need[1001]; while((temp=getchar())!='\n') { ch[temp] += 1; } scanf("%s",need);原创 2017-05-13 20:17:06 · 133 阅读 · 0 评论 -
1038. 统计同成绩学生(20)
//1038. 统计同成绩学生(20)#include#includeint main(){ int score[101]={0},n=0,k=0,i=0,temp=0; scanf("%d",&n); i = 0; while(i<n) { scanf("%d",&temp); score[temp]++; i++; } scanf(原创 2017-05-13 20:16:32 · 143 阅读 · 0 评论 -
1037. 在霍格沃茨找零钱(20)
#includeint main(){ long Gallon1=0,Gallon2=0,Gallon3,temp=0; int Sickle1=0,Sickle2=0,Knut1=0,Knut2=0,Sickle3,Knut3,flag1=0,flag2=0,flag3=0,temp1,temp2; scanf("%ld.%d.%d",&Gallon1,&Sickle1,&K原创 2017-05-13 20:15:51 · 161 阅读 · 0 评论 -
1036. 跟奥巴马一起编程(15)
#includeint main(){ int n=0,i=0,j=0; char ch; scanf("%d %c",&n,&ch); for(i=0; i<(n+1)/2; i++) //行 { if(i==0 || i==(n+1)/2 -1 ) { for(j=0; j<n; j++) printf("%c",ch)原创 2017-05-13 20:15:12 · 139 阅读 · 0 评论 -
1049. 数列的片段和(20)
#includeint main(){ int N=0; double sum=0,x=1,temp=0; scanf("%d",&N); while(N--) { scanf("%lf",&temp); sum += (N+1)*(x++)*temp; } printf("%.2f",sum); return 0;}原创 2017-05-13 20:22:51 · 152 阅读 · 0 评论 -
1051. 复数乘法 (15)
#include#include#define EPS 0.01int main(){ double R1, P1, R2, P2,A,B; double A1,B1,A2,B2; scanf("%lf%lf%lf%lf",&R1,&P1,&R2,&P2); A1 = R1 * cos(P1); B1 = R1 * sin(P1); A2 = R2 * cos原创 2017-05-13 20:23:29 · 157 阅读 · 0 评论 -
1052. 卖个萌 (20)
#include#includevoid read_expression(char arry[][5], int *count){ char temp; int x=1,i=0; while((temp = getchar())!='\n') { if(temp=='[') { i=0; while((temp = getchar(原创 2017-05-13 20:24:06 · 168 阅读 · 0 评论 -
1065. 单身狗(25)
#includeint main(){ int lover[100001]={-1}; bool come[100001]={0}; int single[100001]={0}; int N=0,M=0,a=0,b=0,sum=0,come_max=0,come_min = 100000,j=0,flag=0,i=0; for(i=0; i<100001; i++)原创 2017-05-13 20:30:41 · 265 阅读 · 0 评论 -
1064. 朋友数(20)
#includeint main(){ int N,temp,a=0,b=0,c=0,d=0,sum=0,max=0,min=200,num=0; int pys[200]={0}; scanf("%d",&N); int i=0; while(i<N) { scanf("%d",&temp); sum = 0; a = temp/1000;原创 2017-05-13 20:30:11 · 171 阅读 · 0 评论 -
1063. 计算谱半径(20)
#include#includeint main(){ int N=0,i=0,a=0,b=0; double r=0,max=0; scanf("%d",&N); while(i<N) { scanf("%d%d",&a,&b); a = fabs(a); b = fabs(b); r = sqrt((long double)a*a+b原创 2017-05-13 20:29:42 · 160 阅读 · 0 评论 -
1062. 最简分数(20)
#includeint find_min(int i, int k){ int c; while(k!=0) { c = i%k; i = k; k = c; } return i;}int main(){ int N1,M1,N2,M2,K,flag=0; double x,y,z,temp; scanf("%d/%d %d/原创 2017-05-13 20:29:13 · 156 阅读 · 0 评论 -
1061. 判断题(15)
#includeint main(){ int N,M; int score[100]={0},answer[100]={0},stu_score=0; scanf("%d%d",&N,&M); int i=0; for(i=0; i<M; i++) scanf("%d",&score[i]); for(i=0; i<M; i++) scanf("%原创 2017-05-13 20:28:42 · 330 阅读 · 0 评论 -
1060. 爱丁顿数(25)
#include int main(){ int a[200000] = {0}, n = 0, tmp, sum = 0, max = 0, result = 0; // 题目中只说骑行公里数为非负,却没说多大,这里的200000是通过提交试出来的 scanf("%d", &n); for (int i = 0; i < n; i++, a[tmp]++)原创 2017-05-13 20:28:03 · 188 阅读 · 0 评论 -
1059. C语言竞赛(20)
#include#includeusing namespace std;bool sushu[40000]={0};int is_sushu(int a){ if(sushu[a]==0) return 1; else return 0;}int main(){ int rank[40000]={0}; bool flag[40000]={0};原创 2017-05-13 20:27:23 · 170 阅读 · 0 评论 -
1057. 数零壹(20)
#include#include#includeusing namespace std;int main(){ char str[100000]={0}; unsigned int sum=0,zero=0,one=0; gets(str); int len = strlen(str); for(int i=0; i<len; i++) { if(s原创 2017-05-13 20:26:43 · 199 阅读 · 0 评论 -
1056. 组合数的和(15)
#include#includeusing namespace std;int main(){ int N=0,*num,sum=0; scanf("%d",&N); num = (int *)malloc(sizeof(int)*N); int i=0; while(i<N) { scanf("%d",&num[i]); i++; }原创 2017-05-13 20:26:15 · 134 阅读 · 0 评论 -
1055. 集体照 (25)
#include#include#include#includeusing namespace std;struct Stu{ string name; int height;};int cmp(Stu s1,Stu s2){ if(s1.height==s2.height) return s1.name>s2.name; return s1.height<原创 2017-05-13 20:25:44 · 186 阅读 · 0 评论 -
1054. 求平均值 (20)
#include#include#include#includeusing namespace std;int main(){ char *num[105]; int N,count=0; double average=0; cin>>N; for(int i=0;i<N;i++){ bool isNumber=true;原创 2017-05-13 20:25:10 · 188 阅读 · 0 评论 -
1053. 住房空置率 (20)
#include#includeint main(){ int N,*K,day=0,D,i=0,x=0,may=0,sure=0; double e=0,temp; scanf("%d%lf%d",&N,&e,&D); K = (int *)malloc(sizeof(int)*N); for(i=0; i<N; i++) K[i] = 0; i=0;原创 2017-05-13 20:24:42 · 194 阅读 · 0 评论 -
1034. 有理数四则运算(20)
#include long gg(long x, long y) { x<0?x=-x:x=x; y<0?y=-y:y=y; long m=x%y; while(m) { x=y; y=m; m=x%y; } return y; }原创 2017-05-13 20:14:36 · 317 阅读 · 0 评论 -
1033. 旧键盘打字(20)
#include #include char change(char c) { if(c>='A'&&c<='Z') return c+('a'-'A'); else if(c>='a'&&c<='z') return c+('A'-'a'); else return c; }原创 2017-05-13 20:14:01 · 108 阅读 · 0 评论 -
1032. 挖掘机技术哪家强(20)
//1032. 挖掘机技术哪家强(20)#include#includevoid swap(int *a, int *b){ int temp; temp = *a; *a = *b; *b = temp;}int main(){ int n=0,*num,i=0,j=0,school=0,score=0,x=0,max_school=0,max_score=0;原创 2017-05-13 20:13:22 · 130 阅读 · 0 评论 -
1016. 部分A+B (15)
#include#include#includelong fun(char *str,int x, int len){ long result=0; int i=0; for(i=0; i<len; i++) { if(str[i]==x+'0') result = result*10 + x; } return result;}int原创 2017-05-13 20:03:07 · 327 阅读 · 0 评论 -
1014. 福尔摩斯的约会 (20)
#includeint main(){ char str1[61],str2[61],str3[61],str4[61]; char DAY,HH; int i=0,M=0,first=1; scanf("%s",&str1); scanf("%s",&str2); scanf("%s",&str3); scanf("%s",&str4); for(i=0原创 2017-05-13 20:01:47 · 116 阅读 · 0 评论 -
1013. 数素数 (20)
//素数,1不是素数!,也不是合数!//1013. 数素数 (20)#include#define maxn 1000010bool p[maxn]={0};int prime[maxn]={0},num = 0;void init_p(int n){ for(int i=2; i<maxn; i++) { if(p[i] == false) {原创 2017-05-13 20:00:59 · 152 阅读 · 0 评论 -
1012. 数字分类 (20)
//1012#includeint main(){ int a1=0,a2=0,a3=0,a5=0,n=0,x=0,i=0,flag=1,a4_sum=0,flag_a2=0; double a4=0; scanf("%d",&n); while(n--) { scanf("%d",&x); i = x%5; switch(i) {原创 2017-05-13 19:59:32 · 165 阅读 · 0 评论 -
1011. A+B和C (15)
#include int main() { unsigned int t; double a, b, c; scanf("%d", &t); for (int i = 0; i < t; i++) { scanf("%lf %lf %lf", &a, &b, &c); if ((a + b)原创 2017-05-13 19:58:44 · 131 阅读 · 0 评论 -
1010. 一元多项式求导 (25)
//#include#includeint main(){ int m,n,first=0; while(scanf("%d%d",&m,&n)!=EOF) { if(n*m) { if(first) printf(" "); else first = 1; printf("%d %d",m*原创 2017-05-13 19:58:10 · 129 阅读 · 0 评论 -
1009. 说反话 (20)
#include #include void output(char *str) { char* tail = strchr(str,' '); if (tail == NULL) printf("%s",str); else { output(tail + 1); *tail = '\0';原创 2017-05-13 19:57:33 · 152 阅读 · 0 评论 -
1008. 数组元素循环右移问题 (20)
//1008 数组左移#include#includevoid swap(int *a, int *b){ int temp; temp = *a; *a = *b; *b = temp;}int main(){ int num[100]={0},n,m,i,j; scanf("%d",&n); scanf("%d",&m); m = m%n;原创 2017-05-13 19:56:46 · 183 阅读 · 0 评论 -
1007. 素数对猜想 (20)
//1007 素数猜想//特备要注意j是从2i开始而不是i!!//这里不能单纯的i直接加2,而且调剂成立应该加3而不是2!如果不符合要求则加1#include#include#includeint main(){ bool num[100000]={0}; int i,j,n,x=0; for(j=0; j<100000; j++) num[j]=0; f原创 2017-05-13 19:56:18 · 168 阅读 · 0 评论