- 博客(15)
- 问答 (1)
- 收藏
- 关注
原创 PAT 乙级 1018 石头剪刀布 20分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805304020025344 #include<stdio.h> int main() { int n; scanf("%d",&n); char jia[n]; char yi[n]; for(int ...
2019-03-30 15:35:13 114
原创 c语言qsort函数
函数库:<stdlib.h> 函数声明 void qsort(void * base,size_t nmemb,size_t size ,int(*compar)(const void *,const void *)); 参数说明: base,要排序的数组 nmemb,数组中元素的数目 size,每个数组元素占用的内存空间,可使用sizeof函数获得 compar,指向函数的指针也即函...
2019-03-30 11:01:06 858
转载 PAT 乙级 1020 乙级 月饼 25分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805301562163200 /* * 1. 最大收益 —— 单价从高到低 出货 * 2. 需要考虑 全部库存仍无法满足需求 的情况 */ #include <stdio.h> #include <stdlib.h> typede...
2019-03-30 10:56:06 87
原创 PAT 乙级 1030 完美数列 25分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805291311284224 #include<stdio.h> int main() { int n,p; scanf("%d%d",&n,&p); int s[n+1]; for(int i=1;i<n+1;i++) {...
2019-03-27 19:49:23 195
原创 PAT 1013数素数 20分 乙级
题目: https://pintia.cn/problem-sets/994805260223102976/problems/994805309963354112 #include<stdio.h> #include<math.h> int isprime(int i) { if(i==2) { return 1; } else { for(int j=2...
2019-03-27 09:44:57 122
原创 PAT 乙级 1005 继续3n+1猜想 25分
题目: #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int a[10000],b[10000];//a是用来标志哪个数字被覆盖 void find(int n)//执行3n+1猜想 如果猜想中有哪一个数字出现了 记录到a数组里面 { whi...
2019-03-25 17:05:29 202
原创 PAT 乙级 1091 自守数 15分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/1071785664454127616 #include<stdio.h> #include<math.h> int main() { int m; scanf("%d",&m); int k; for(...
2019-03-24 15:57:38 184
原创 PAT 1087 有多少不同值 20分 乙级
题目:https://pintia.cn/problem-sets/994805260223102976/problems/1038429191091781632 #include<stdio.h> int main() { int n; scanf("%d",&n); int result[n]; int count=0; for...
2019-03-24 15:06:55 160
原创 PAT 乙级 1086 15分 就不告诉你
题目:https://pintia.cn/problem-sets/994805260223102976/problems/1038429065476579328 #include<stdio.h> int main() { int x,y; scanf("%d%d",&x,&y); int s; s=x*y; if(s==0) ...
2019-03-24 14:43:21 173
原创 PAT 乙级 1083 是否存在相等的差 20分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805260780945408 #include<stdio.h> #include<math.h> int main() { int n; scanf("%d",&n); int num[n+1]; ...
2019-03-23 18:12:23 185
原创 PAT 乙级 1082 射击比赛 20分
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805260990660608 #include<stdio.h> #include<math.h> struct stu { char id[10]; int i; int x; int y; }; int main() { in...
2019-03-23 17:48:46 113
原创 1081 检查密码 15分PAT 乙级
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805261217153024 #include<cstdio> #include<cstring> int check(char s[],int m){ int num=0,alph=0; for(int i=0;i<m;...
2019-03-23 17:21:05 188
原创 PAT 乙级 1077 互评成绩计算
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805262303477760 #include<stdio.h> int main() { int n,m; scanf("%d%d",&n,&m); int grade[n]; float g1,g2; ...
2019-03-23 14:49:46 193
原创 PAT 乙级 1076 15分 WiFi密码
题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805262622244864 #include<stdio.h> int main() { int n; scanf("%d",&n); char s[8*n]; for(int i=0;i<8*n;i+=8) ...
2019-03-22 15:00:06 85
原创 2的幂次方表示
题目:http://cxsjsxmooc.openjudge.cn/2019t2springw2/2/ 分析: for exmple 137=27+23+2*0=…将一个大的数据拆分成小的数据,并且小的数据可以按同一方法继续拆分,很容易让我们想到递归算法 n=2^y+c;递归的边界条件是x1或x2; f(7)=2(f(2))+f(3)=2(f(2))+f(2)+f(1)) #include<...
2019-03-10 15:56:56 766
空空如也
cin数组元素问题 dev和vs中不同结果
2019-09-03
TA创建的收藏夹 TA关注的收藏夹
TA关注的人