chp居然没来。。然后我跟zmc鼓捣了一下午。。出了3题 有一道貌似是DP水题。。然后我俩都不会dp。。A题水题不说了,E题博弈论模板。。然后我俩也都不会博弈论。。现场找的模板。。F题无脑BFS。。一开始看成计算几何了没敢做sad。。

A题:

Post Robot

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 57    Accepted Submission(s): 51

Problem Description
DT is a big fan of digital products. He writes posts about technological products almost everyday in his blog.

But there is such few comments of his posts that he feels depressed all the day. As his best friend and an excellent programmer, DT asked you to help make his blog look more popular. He is so warm that you have no idea how to refuse. But you are unwilling to read all of his boring posts word by word. So you decided to write a script to comment below his posts automatically.

After observation, you found words “Apple” appear everywhere in his posts. After your counting, you concluded that “Apple”, “iPhone”, “iPod”, “iPad” are the most high-frequency words in his blog. Once one of these words were read by your smart script, it will make a comment “MAI MAI MAI!”, and go on reading the post.

In order to make it more funny, you, as a fan of Sony, also want to make some comments about Sony. So you want to add a new rule to the script: make a comment “SONY DAFA IS GOOD!” when “Sony” appears.

Input
A blog article described above, which contains only printable characters(whose ASCII code is between 32 and 127), CR(ASCII code 13, ‘\r’ in C/C++), LF(ASCII code 10, ‘\n’ in C/C++), please process input until EOF. Note all characters are case sensitive.

The size of the article does not exceed 8KB.

Output
Output should contains comments generated by your script, one per line.
Sample Input
Apple bananaiPad lemon ApplepiSony 233 Tim cook is doubi from Apple iPhoneipad iPhone30 is so biiiiiiig Microsoft makes good App.
Sample Output
MAI MAI MAI! MAI MAI MAI! MAI MAI MAI! SONY DAFA IS GOOD! MAI MAI MAI! MAI MAI MAI! MAI MAI MAI!

水 1Y;

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
#define LL long long
char s[1000010];
int main()
{while(gets(s)){int len=strlen(s);for(int i=0;i<len;i++)if(!strncmp(s+i,"Apple",5))puts("MAI MAI MAI!");else if(!strncmp(s+i,"iPhone",6))puts("MAI MAI MAI!");else if(!strncmp(s+i,"iPod",4))puts("MAI MAI MAI!");else if(!strncmp(s+i,"iPad",4))puts("MAI MAI MAI!");else if(!strncmp(s+i,"Sony",4))puts("SONY DAFA IS GOOD!");}return 0;
}

E题:

Game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 55    Accepted Submission(s): 41

Problem Description
Here is a game for two players. The rule of the game is described below:

● In the beginning of the game, there are a lot of piles of beads.

● Players take turns to play. Each turn, player choose a pile i and remove some (at least one) beads from it. Then he could do nothing or split pile i into two piles with a beads and b beads.(a,b > 0 and a + b equals to the number of beads of pile i after removing)

● If after a player's turn, there is no beads left, the player is the winner.

Suppose that the two players are all very clever and they will use optimal game strategies. Your job is to tell whether the player who plays first can win the game.

Input
There are multiple test cases. Please process till EOF.

For each test case, the first line contains a postive integer n(n < 105) means there are n piles of beads. The next line contains n postive integer, the i-th postive integer ai(ai < 231) means there are ai beads in the i-th pile.

Output
For each test case, if the first player can win the game, ouput "Win" and if he can't, ouput "Lose"
Sample Input
1 1 2 1 1 3 1 2 3
Sample Output
Win Lose Lose

博弈论 尼姆博奕(Nimm Game)

指的是这样的一个博弈游戏,目前有任意堆石子,每堆石子个数也是任意的,双方轮流从中取出石子,规则如下:
1)每一步应取走至少一枚石子;每一步只能从某一堆中取走部分或全部石子;
2)如果谁取到最后一枚石子就胜。
也就是尼姆博弈(Nimm Game)。

结论:假设有n堆物品,每堆物品有a[i]件,若a[0]^a[1]^a[2]^........a[n-1]!=0 先手必胜,否则必败。

#include <cstdio>
using namespace std;
int main()
{int n,t,x;while(~scanf("%d",&n)){scanf("%d",&t);--n;while(n--){scanf("%d",&x);t^=x;}if(t)puts("Win");else puts("Lose");}return 0;
}

F题:

Dice

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 93    Accepted Submission(s): 54

Problem Description
There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a1.a2,a3,a4,a5,a6 to be numbers written on top face, bottom face, left face, right face, front face and back face of dice A. Similarly, consider b1.b2,b3,b4,b5,b6 to be numbers on specific faces of dice B. It’s guaranteed that all numbers written on dices are integers no smaller than 1 and no more than 6 while ai ≠ aj and bi ≠ bj for all i ≠ j. Specially, sum of numbers on opposite faces may not be 7.

At the beginning, the two dices may face different(which means there exist some i, ai ≠ bi). Ddy wants to make the two dices look the same from all directions(which means for all i, ai = bi) only by the following four rotation operations.(Please read the picture for more information)


Now Ddy wants to calculate the minimal steps that he has to take to achieve his goal.

Input
There are multiple test cases. Please process till EOF.

For each case, the first line consists of six integers a1,a2,a3,a4,a5,a6, representing the numbers on dice A.

The second line consists of six integers b1,b2,b3,b4,b5,b6, representing the numbers on dice B.

Output
For each test case, print a line with a number representing the answer. If there’s no way to make two dices exactly the same, output -1.
Sample Input
1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 5 6 4 3 1 2 3 4 5 6 1 4 2 5 3 6
Sample Output
0 3 -1

六维BFS。

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
struct node
{int a[7],step;
};
bool vis[7][7][7][7][7][7];
int s[7],e[7];
void bfs()
{queue <node> Q;node t,f;for(int i=1;i<7;i++)t.a[i]=s[i];t.step=0;vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);while(!Q.empty()){f=Q.front();Q.pop();if(f.a[1]==e[1]&&f.a[2]==e[2]&&f.a[3]==e[3]&&f.a[4]==e[4]&&f.a[5]==e[5]&&f.a[6]==e[6]){printf("%d\n",f.step);return ;}t.step=f.step+1;//leftt.a[1]=f.a[4];t.a[2]=f.a[3];t.a[3]=f.a[1];t.a[4]=f.a[2];t.a[5]=f.a[5];t.a[6]=f.a[6];if(!vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]){vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);}//rightt.a[1]=f.a[3];t.a[2]=f.a[4];t.a[3]=f.a[2];t.a[4]=f.a[1];t.a[5]=f.a[5];t.a[6]=f.a[6];if(!vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]){vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);}//frontt.a[1]=f.a[6];t.a[2]=f.a[5];t.a[3]=f.a[3];t.a[4]=f.a[4];t.a[5]=f.a[1];t.a[6]=f.a[2];if(!vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]){vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);}//backt.a[1]=f.a[5];t.a[2]=f.a[6];t.a[3]=f.a[3];t.a[4]=f.a[4];t.a[5]=f.a[2];t.a[6]=f.a[1];if(!vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]){vis[t.a[1]][t.a[2]][t.a[3]][t.a[4]][t.a[5]][t.a[6]]=1;Q.push(t);}}puts("-1");
}
int main()
{while(~scanf("%d",&s[1])){memset(vis,0,sizeof(vis));for(int i=2;i<7;i++)scanf("%d",&s[i]);for(int i=1;i<7;i++)scanf("%d",&e[i]);bfs();}return 0;
}

acm_icpc网络赛第三站:西安赛区相关推荐

  1. 2011 ACM/ICPC 福州赛区网络赛解题报告

    第一次写网络赛的题解,福州赛区网络赛作为我第一年ACM最后一次网络赛酱油,画了一个很像逗号的句号.....好吧,还得为北京现场赛准备啊准备....... 这次酱油打的很犀利,貌似出第一题很快,之后节奏 ...

  2. 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 B Coin (概率计算)

    传送门:  https://nanti.jisuanke.com/t/17115 Bob has a not even coin, every time he tosses the coin, the ...

  3. 计蒜客 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 B coin(求乘法逆元)

    Bob has a not even coin, every time he tosses the coin, the probability that the coin's front face u ...

  4. 2017 ACM-ICPC 亚洲区(西安赛区)网络赛

    这个西安赛区大概是我们学校打得最好的一次了,因为数学题多,而且嘛,那个I竟然就是暴力,恭喜我们学校分了个机会 Coin 问答 只看题面 23.46% 1000ms 32768K Bob has a n ...

  5. 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 xor (根号分治)

    xor There is a tree with nn nodes. For each node, there is an integer value a_ia​i​​, (1 \le a_i \le ...

  6. 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 B Coin(逆元,费马小定理)

    Bob has a not even coin, every time he tosses the coin, the probability that the coin's front face u ...

  7. 华为杯大学生计算机软件大赛,关于举办2018年西安电子科技大学程序设计网络赛暨第十六届“华为杯”大学生程序设计竞赛的通知...

    各学院: 程序设计是大学生运用计算机充分展示自己分析问题和解决问题能力的一个重要途径,对于培养大学生实践能力.团队意识.创新意识.顽强意志和综合素质具有显著作用和效果.为了推动这项创新性素质教育活动的 ...

  8. 计蒜客 17115 2017 ICPC 西安网络赛 B Coin

    Problem nanti.jisuanke.com/t/17115 Reference 关于二项展开式系数和 [二项式定理][推导]计蒜客17115 2017 ACM-ICPC 亚洲区(西安赛区)网 ...

  9. 2014 ACM/ICPC 北京赛区网络赛解题报告汇总

    首页 算法竞赛» 信息聚合 ONLINE JUDGE 书刊杂志 BLOG» 新闻故事» 招聘信息» 投稿须知 2014 ACM/ICPC 北京赛区网络赛解题报告汇总 九月 21st, 2014 | P ...

最新文章

  1. SAP WORK FLOW
  2. 想学习Android开发
  3. 更多核心、更大内存、更低成本 AMD皓龙6000欲成云计算基石
  4. 服务器虚拟化的主备,云服务器可以主备切换
  5. 蓝桥杯 基础练习 字符串对比
  6. 【CF 670C】Cinema
  7. 多线程编程下单例模式与多例模式的使用总结
  8. Atitit 单点登录实现几种模式架构图 目录 1. 因此要点也就以下两个:存储信任验证信任 1 1.1. 共享cookie (最简单 1 1.2. 通过 url带token参数跳转 1 1.3.
  9. 通信系统是如何收发复数信号的:IQ 调制原理
  10. 欧拉角到方向余弦矩阵
  11. win101909要不要更新_win10游戏电脑要不要更新到1909版本?
  12. [python]os库与shutil库与操作系统的交互-整理硬盘中Vivaldi的作品
  13. 剁手党:过年想收快递!马云:照常送!最高补贴三千让快递员团圆
  14. SQL语句中,有了别名不能再用原名,需要使用别名
  15. zabbix告警列队清理
  16. Qt开发基础(7)——QImage与Mat之间的相互转换
  17. 自己动手搭建一个简单的网站
  18. Eclipse使用c3p0连接池出现A ResourcePool could not acquire a resource from its primary factory or sour错误
  19. 腾讯、阿里、百度、字节跳动最新复工时间,最晚3月2日回公司上班
  20. java 客户端定时任务_定时任务最简单的3种实现方法(超实用)

热门文章

  1. wps在word文档中插入xlsx格式文档会自动打开
  2. mysql 异常码1903_Mysql 异常。 寻求帮助
  3. 哪款蓝牙耳机降噪好?值得推荐的降噪蓝牙耳机!
  4. stm32: 串口空闲中断的实现(HAL库)
  5. JVM (1) JVM为什么需要GC?
  6. 「JavaSE」- 常用类
  7. Android调用第三方App Activity
  8. Linux系统看门狗应用编程
  9. 计算机的纸牌游戏打不开啥原因,win10系统游戏纸牌打不开解决方法 - Win10专业版官网...
  10. Centos7安装JDK【FinalShell终端本地文件上传失败解决办法】