PAT乙
「已注销」
这个作者很懒,什么都没留下…
展开
-
PAT乙1001. 害死人不偿命的(3n+1)猜想 (15)
#include int main(){ int n,step; while(scanf("%d",&n)!=EOF){ step=0;//计数器 while(n!=1){ if(n%2==0) n/=2;//若为偶数,则减半 else n=(3*n+1)/2;//若为奇数,则(3*n+1)/2 ++step;//计数器进行累加原创 2018-01-31 11:02:04 · 153 阅读 · 0 评论 -
PAT乙1076. Wifi密码 (15)
/* 8 A-T B-F C-F D-F C-T B-F A-F D-F A-F D-F C-F B-T B-T A-F C-F D-F B-F D-T A-F C-F A-T C-F B-F D-F D-T B-F C-F A-F C-T A-F B-F D-F 输出样例: 13224143 */ #include using namespace std; //int main(){ //原创 2018-01-30 10:50:03 · 205 阅读 · 0 评论 -
PAT乙1036. 跟奥巴马一起编程(15)
/* 10 a 输出样例: aaaaaaaaaa a a a a a a aaaaaaaaaa */ #include using namespace std; int main(){ int n,i,j; char c; cin>>n>>c; for(j=1;j<=n;j++) cout<<c; cout<<endl; fo原创 2018-01-30 09:58:15 · 134 阅读 · 0 评论 -
PAT乙1042. 字符统计(20)
/* This is a simple TEST. There ARE numbers and other symbols 1&2&3..... e 7 输入在一行中给出一个长度不超过1000的字符串。字符串由ASCII码表中任意可见字符及空格组成, 至少包含1个英文字母,以回车结束(回车不算在内)。 在一行中输出出现频率最高的那个英文字母及其出现次数,其间以空格分隔。如果有并列, 则输出按字母原创 2018-01-30 07:19:11 · 139 阅读 · 0 评论 -
PAT乙1023. 组个最小数 (20)
1注意审题:是0-9已经统计出来了,所以只需要进行筛选和输出 /* 2 2 0 0 0 3 0 0 1 0 10015558*/ #include using namespace std; int main(){ int i,count[10]; for(i=0;i<10;i++) cin>>count[i]; for(i=1;i<10;i++) if(co原创 2018-01-29 17:18:05 · 185 阅读 · 0 评论 -
pat乙1021. 个位数统计 (15)
#include #include int main(){ char str[1001]; int count[10]={0}; int i; scanf("%s",str); int len=strlen(str); for(i=0;i<len;i++) count[str[i]-'0']++; for(i=0;i<10;i++)原创 2018-01-29 15:51:04 · 139 阅读 · 0 评论 -
PAT乙1009. 说反话 (20)解法2
#include #include void change(char str[]){ for(int i=0,j=strlen(str)-1;i<j;i++,j--){ char temp=str[i]; str[i]=str[j]; str[j]=temp; } } int main(){ char str[81]; gets(str); change(原创 2018-02-04 22:25:09 · 247 阅读 · 0 评论 -
PAT乙1009. 说反话 (20)
#include int main(){ char str[81][20]; int n=0; char c; do{ scanf("%s",str[n++]); //I am a student c = getchar(); }while(c!='\n'); for(int i=n-1;i>0;--i) printf("%s ",str[i]); printf("%s\原创 2018-02-04 22:24:08 · 178 阅读 · 0 评论 -
PAT乙1037
#include //char s[]="1234"; //int tmp=0; //for(i=0;s[i];i++){ // tmp=tmp*10+s[i]-'0';//1 //} //int A=1234; //qian = A/1000; //A %= 1000; //bai = A/100; //A %= 100; //shi = A/10; //A %= 10; //ge = A/1;原创 2018-02-02 22:24:23 · 190 阅读 · 0 评论 -
PAT乙1037. 在霍格沃茨找零钱(20)
/* 1G=17S=29*17K 10.16.27 14.1.28 G0~107.S0~17.K0~29 3.2.1 14.1.28 10.16.27 -3.2.1 全部转换为k,然后零钱再转换为对应的格式*/ #include int main(){ int P,A,change; int G,S,K; int g1,s1,k1,g2,s2,k2; while(sca原创 2018-02-01 22:12:52 · 117 阅读 · 0 评论 -
PAT乙1005. 继续(3n+1)猜想 (25)
#include#include using namespace std; bool cmp(int x,int y){ return x>y; } int mark[101]={0}; void Mark(int x){//标记函数 if(mark[x]) return; while(x!=1){ if(x%2) x=3*x+1; else{ x /= 2原创 2018-02-01 22:11:37 · 152 阅读 · 0 评论 -
PAT乙1020. 月饼 (25)
#include #include using namespace std; struct Moon{ double w;//weight double v;//price double s;//性价比 }Cake[1001]; bool cmp(Moon a,Moon b){ return a.s>b.s; } int main(){ int N,i; double原创 2018-02-01 22:10:03 · 518 阅读 · 0 评论 -
1039. 到底买不买(20)
/* ppRYYGrrYBR2258 YrR8RrY ppRYYGrrYB225 YrR8RrY Yes 8 No 2*/ /*解题思路:统计两串的字符,数字,字母*/ #include<stdio.h> #include<string.h> void count(char A[],int ans[]){ for(int i=0;i<62;i++) ans[i...原创 2018-02-24 16:50:41 · 168 阅读 · 0 评论