Google Code Jam 2012 Qualification Round
来源:互联网 发布:人工智能打败李世石 编辑:程序博客网 时间:2024/05/18 02:53
Problem A. Speaking in Tongues
简单的加密解密题,字母对应关系需要从题目和样例中得出。
#include <iostream>#include <cstring>#include <cstdio>using namespace std;char map[]="yhesocvxduiglbkrztnwjpfmaq";char st[500],str[500];int main(){int t,i,j;//freopen("d:\\gcj\\a.in","r",stdin);//freopen("d:\\gcj\\a.out","w",stdout);scanf("%d",&t);getchar();for(i=1;i<=t;i++){gets(st);printf("Case #%d: ",i);for(j=0;j<strlen(st);j++)if(st[j]!=' ')str[j]=map[st[j]-'a'];elsestr[j]=st[j];str[j]='\0';puts(str);}return 0;}Problem B. Dancing With the Googlers
小学数学题,告诉你三个评委的评分总分,让你判断是否存在一个分数大于q。
#include <iostream>#include <cstring>using namespace std;int n,s,p,tol[150];int main(){int t,i,j;//freopen("d:\\gcj\\b.in","r",stdin);//freopen("d:\\gcj\\b.out","w",stdout);scanf("%d",&t);for(i=1;i<=t;i++){scanf("%d%d%d",&n,&s,&p);int cnt=0;for(j=0;j<n;j++){scanf("%d",&tol[j]);if(!p){cnt++;continue;}if(!tol[j] && p)continue;if(tol[j]>=p*3-2)cnt++;if(tol[j]>=p*3-4 && tol[j]<=p*3-3 && s){cnt++;s--;}}printf("Case #%d: ",i);printf("%d\n",cnt);}return 0;}
Problem C. Recycled Numbers
给你一个给定区间,让你判断该区间中有多少对移位排列的数。
#include <iostream>#include <cstring>#include <algorithm>using namespace std;int n,s,p,tol[150];char str[100],st[100],st1[100];int main(){int t,i,j,k,a,b;//freopen("d:\\gcj\\c.in","r",stdin);//freopen("d:\\gcj\\c.out","w",stdout);scanf("%d",&t);for(i=1;i<=t;i++){int cnt=0;scanf("%d%d",&a,&b);for(j=a;j<=b;j++){itoa(j,str,10);int len=strlen(str);st[len-1]=str[0];for(k=1;k<len;k++)st[k-1]=str[k];st[len]='\0';while(strcmp(st,str)!=0){int tmp=atoi(st);if(tmp>=a && tmp<=b)cnt++;strcpy(st1,st);st[len-1]=st1[0];for(k=1;k<len;k++)st[k-1]=st1[k];st[len]='\0';}}printf("Case #%d: ",i);printf("%d\n",cnt/2);}return 0;}
Problem D. Hall of Mirrors
告诉你镜子和人的位置,让你判断人能看到自己多少个镜像。
物理奇差的表示压力很大,张哥给我了解决方案,就是弄的不是很明白,于是还是放弃了。。
看了题解发现张哥果断NB啊。。物理大神就是不一样。。
- Google Code Jam 2012 Qualification Round
- Google Code Jam Qualification Round 2012
- Google Code Jam 2010 Qualification Round 2012 Problem B && C
- 2009 Google Code Jam Qualification Round 题解
- Google Code Jam 2011 Qualification Round ProblemA
- Reverse-GOOGLE CODE JAM AFICA 2010 Qualification Round
- T9 Spelling-GOOGLE CODE JAM AFICA 2010 Qualification Round
- Store Credit-GOOGLE CODE JAM AFICA 2010 Qualification Round
- ACM-GOOGLE CODE JAM 2011 Qualification Round 2011(总结)
- Google Code Jam 2014 Qualification Round 2014 A B D
- Google Code Jam 2014-Qualification Round-Problem C. Minesweeper Master
- Google Code Jam 2014 Qualification Round:Problem A. Magic Trick
- Google Code Jam 2014 Qualification Round:D. Deceitful War
- Google Code jam Qualification Round 2015 解题报告
- Google Code Jam 2015 Qualification Round: Problem A. Standing Ovation
- Google Code Jam 2015 Qualification Round: Problem C. Dijkstra
- Google Code jam Qualification Round 2015 --- Problem A. Standing Ovation
- 【google code jam Qualification Round 2017】【Oversized Pancake Flipper】【贪心】
- 覆盖
- LLE算法与实现
- VirtualBox使用教程图解
- make介绍与使用
- 跟工作环境相关的一些问题
- Google Code Jam 2012 Qualification Round
- 匿名类
- 黑马程序员--多线程
- 局域网上网配置流程
- hadoop wordcount 相关资料
- WMI003-WMI学习笔记(三)——Windows Management Instrumentation(Windows管理工具)
- Python:pygame游戏编程之旅一(Hello World)
- ARM 经典300 问
- 黑马程序员——网络编程