群赛53
来源:互联网 发布:中国前三季度经济数据 编辑:程序博客网 时间:2024/04/29 23:58
很久没做群赛...秀逗了.
A水:
#include<stdio.h>#include<string.h>int main(){ char a[33]; int counter; while(~scanf("%s",a)){ if(a[0]=='#') break; counter=0; int len=strlen(a); for(int i=0;i<len;i++){ if(a[i]=='1') counter++; } if(counter%2==0){ if(a[len-1]=='e') a[len-1]='0'; if(a[len-1]=='o') a[len-1]='1'; } else { if(a[len-1]=='e') a[len-1]='1'; if(a[len-1]=='o') a[len-1]='0'; } printf("%s\n",a); }}
B是阅读题T_T:
#include<stdio.h>#include<math.h>typedef struct{ double x,y;}node;node s,t,ans;double dis(node a,node b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}int main(){ int i,I=1,d; double r,du; while( scanf("%lf",&r)!=EOF) { scanf("%lf%lf",&s.x,&s.y); if(r==0&&s.x==0&&s.y==0)break; i=1; d=0; while(scanf("%lf%lf",&t.x,&t.y)!=EOF) { if(t.x==-1&&t.y==-1)break; du=dis(s,t); if(du<=r+1&&0==d) { ans=t; d=1; } s.x+=(t.x-s.x)*(r/du); s.y+=(t.y-s.y)*(r/du); i++; } printf("Firefly %d ",I++); if(0==d)printf("not caught\n"); else printf("caught at (%.0lf,%.0lf)\n",ans.x,ans.y); } return 0;}
CDEFG没看
因为H一直PE,,,字符串的题目太恶心了...
后来看了一个大神的代码,,,大赞...
贴下:
using namespace std;char decode[]=" ABCDEFGHIJKLMNOPQRSTUVWXYZ',-.?";int main(){ int spaces=0; int bits=0; int code=0; char c; while((c=getchar())!='#'){ if(c==' ') ++spaces; else{ if(spaces>0){ code=(code<<1)+1-(spaces&1);//当space为为偶数时,与上1变成0,+1,当space为奇数时与上1为1,+0 spaces=0; if(++bits==5){ cout<<decode[code]; code=bits=0;} } if(c=='*'){ if(bits>0){ cout<<decode[code<<(5-bits)]; code=bits=0;} cout<<endl;}}} return 0;}
I题好难,一开始还YY线段树,然后又觉得背包-.-结果到最后也没人做出
J题签到题:
#include<stdio.h>int main(){ int a,b; while(~scanf("%d%d",&a,&b)){ printf("%d %d\n",b-1,a-1); } return 0;}
- 群赛53
- 群赛
- 群赛54
- 群赛59
- ACM 群赛
- 53
- 53
- 53
- DIY群赛 1004
- ACM群赛(二)
- 20160821群赛round4
- 20160823群赛round6
- 20160825群赛round8
- 群赛4总结
- 群赛7总结
- 群赛11----2017.9.20
- 群赛12----2017.9.24
- 群赛13----2017.9.24
- SEO的核心思想
- for update 和 for update of 有什么区别
- Eclipse 插件小结
- 网站推广应有的心态
- TCP校验和详细讲解和计算
- 群赛53
- vs2005 应用程序正常初始化失败的解决方案
- ios界面元素尺寸
- python多线程编程
- C语言 内存中结构体字节对齐
- MyEclipse,Eclipse项目工程出现感叹号或者无故项目报错
- 一步一步的学习android应用开发到系统底层开发之android开发层次及所需技术
- Smarclient框架Datasource与服务端交互数据格式
- 进程调度模拟