ZOJ 2104 Let the Balloon Rise
来源:互联网 发布:家用跑步机推荐 知乎 编辑:程序博客网 时间:2024/05/16 14:10
ZOJ 2104 Let the Balloon Rise {3687}
寒假还有2天就要结束了,好吧,明天再把没完成的杭电acm step做几道,就这样了,所以这是寒假做的最后一道ZOJ初学者?遗憾离 A 60道还有14道的距离。
题意:给出表示气球颜色的单词,输出出现次数最多的颜色的单词。
思路:用结构体。两个字符串比较是否相同最好单独写成一个函数。学指针的时候学过一个现成的函数用来比较是否相同,对它的返回值规则不太了解,所以就自己写了一个。
代码:
#include<stdio.h>#include<string.h>int judge(char a[20],char b[20]){int f,j;f = 0;if(strlen(a)==strlen(b)){f = 1;for(j = 0;j<=strlen(a)-1;j++){if(a[j]!=b[j]){f = 0;break;}}}return f;}int main(){int i,j,k,n,h,max;struct color{char name[20];int a;}c[2000];for(i = 1;;i++){scanf("%d",&n);if(n==0)break;for(j = 0;j<=n-1;j++){c[j].a = 0;}for(j = 0;j<=n-1;j++){scanf("%s",c[j].name);}for(j = 0;j<=n-1;j++){for(k = 0;k<=n-1;k++){if(judge(c[j].name,c[k].name)==1){c[j].a++;}}}max = 0;h = 0;for(j = 0;j<=n-1;j++){if(c[j].a>max){max = c[j].a;h = j;}}printf("%s\n",c[h].name);}return 0;}
- zoj 2104 Let the Balloon Rise
- ZOJ 2104 Let the Balloon Rise
- ZOJ 2104 Let the Balloon Rise
- ZOJ 2104 Let the Balloon Rise
- zoj 2104 Let the Balloon Rise
- ZOJ 2104Let the Balloon Rise
- ZOJ Problem Set - 2104 Let the Balloon Rise
- ZOj 2104——Let the Balloon Rise
- ZOJ Problem Set - 2104 Let the Balloon Rise
- zoj 2104.Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Python装饰器学习
- 企业移动应用的8个建议
- IOS之拾取器piker
- 三维显示软件制作--显示部分(2)
- 黑马程序员 交通灯管理系统
- ZOJ 2104 Let the Balloon Rise
- 闲说Windows 扫雷小游戏
- Maya Mel 编辑表达式快捷键命令
- 移动互联网的迷思与新媒体的困窘
- Repeating Groups
- GNU/Linux下如何设计PCB印刷电路板
- url=jdbc\:mysql\://localhost\:3306/strutsempmanager
- 跟着老毕学Java之IO字符流
- public class LoginAction extends ActionSupport {