Problem L. World Cup(2016China-Final)【暴力】
来源:互联网 发布:js数组删除元素splice 编辑:程序博客网 时间:2024/05/14 11:28
source:题目链接
题意:这是2016 ACM-ICPC China-Final的L题,说4个队踢单循环赛,赢得3分输得0分平得1分,六场比赛下来会出现许多种分数情况,现在给一个分数情况,问这种分数情况可不可能出现,可能出现的话是否是唯一的?
思路:6层循环暴力枚举比赛情况,4维数组存储四个队每个分数情况出现个数。
代码如下:
#include<bits/stdc++.h>using namespace std;int table[11][11][11][11]; //用于记录所有可能出现的比分情况中某种得分情况出现的次数int main(){ int t,T,n,a,b,c,d,sa,sb,sc,sd; int score_p1[3]={3,0,1}; int score_p2[3]={0,3,1}; //清零 memset(table,0,sizeof(table)); //暴力枚举六场比赛情况 for(int ab=0;ab<3;ab++) for(int ac=0;ac<3;ac++) for(int ad=0;ad<3;ad++) for(int bc=0;bc<3;bc++) for(int bd=0;bd<3;bd++) for(int cd=0;cd<3;cd++) { //计算每种情况下得分情况 sa=score_p1[ab]+score_p1[ac]+score_p1[ad]; sb=score_p2[ab]+score_p1[bc]+score_p1[bd]; sc=score_p2[ac]+score_p2[bc]+score_p1[cd]; sd=score_p2[ad]+score_p2[bd]+score_p2[cd]; table[sa][sb][sc][sd]++; } scanf("%d",&T); for(t=1;t<=T;t++) { scanf("%d%d%d%d",&a,&b,&c,&d); switch(table[a][b][c][d]) { case 0: printf("Case #%d: Wrong Scoreboard\n",t);break; case 1: printf("Case #%d: Yes\n",t);break; default:printf("Case #%d: No\n",t);break; } } return 0;}
0 0
- Problem L. World Cup(2016China-Final)【暴力】
- 2016 China-Final A. Number Theory Problem
- 2016 World Final L Swap Space
- 2016亚洲区域赛现场赛china final L题
- Problem A. Number Theory Problem(2016China-Final)【找规律】
- Problem H. Great Cells(2016 China-Final)【数学计数+智力题】
- Problem E. Bet(2016 China-Final)【高精度除法】
- 2016 icpc china final
- cf#8VC Venture Cup 2016 - Final Round (Div. 2 Edition) -A. Orchestra暴力水题
- 2016 ICPC China Final 总结
- 2016 China-Final 解题报告
- (L) CHINA
- Problem D. Ice Cream Tower(2016 China-Final)【二分答案+贪心检验】
- Problem D. Ice Cream Tower (The 2016 ACM-ICPC Asia China-Final Contest)(二分)
- gym101194 china final Problem E. Bet(数学,高精度)
- gym101194 china final Problem D. Ice Cream Tower(二分)
- ACM/ICPC WORLD FINAL 2015 Problem A
- world cup
- POJ - 1860 Currency Exchange解题报告
- Android 记住密码和自动登录界面的实现(SharedPreferences 的用法)
- MySQL数据库——修改约束基本操作
- leetcode Populating Next Right Pointers in Each Node
- UVA10791:Minimum Sum LCM(数论)
- Problem L. World Cup(2016China-Final)【暴力】
- 我的2016
- 这儿有自学前端开发的吗-
- 58 同城 iOS 客户端网络框架的演进之路
- 服务器跳转与客户端跳转的区别
- MySQL数据库——修改数据库与列的基本操作
- web.xml 配置介绍
- 移动开发人机交互
- 1039. Course List for Student (25)PAT甲级