C
来源:互联网 发布:淘宝客服刚去要学什么 编辑:程序博客网 时间:2024/06/18 17:34
Fat brother and Maze are playing a kind of special (hentai) game with some cards. In this game, every player gets N cards at first and these are their own card decks. Each of these two decks of cards is stacking together at the beginning of the game, and their order would not change during this game. The game goes for N rounds and in each round, Fat Brother and Maze would draw one card from the top of their own remaining card deck and sum these two integers together. If this number is greater than 10, Fat Brother would score 1 victory point and otherwise Maze would score 1 victory points. And then these two cards are removed from the game such that they would not appear in the later rounds. As we all know, Fat Brother is very clever, so he would like to know the number of the victory points he could get if he knows all the integers written in these cards. At the beginning of this game, each player has 0 victory point.
The first line of the date is an integer T (1 <= T <= 100), which is the number of the text cases.
Then T cases follow, each case contains an integer N (1 <= N <= 10000) which described before. Then follow two lines with N integers each. The first N integers indicate the cards which Fat Brother gets from top to bottom, and the second N integers indicate the cards which Maze gets from top to bottom.
All the integers are positive and least than 10.
For each case, output the case number first, and then output the number of victory points Fat Brother would gets in this game.
215623 43 4
Case 1: 1Case 2: 0
因为不是随机抽牌,只要遍历找出俩卡和>10的数量求和就是了
#include<cstdio>int i,n,t,k,p=1;int a[10010],b[10010];int main(){scanf("%d",&t);while(t--){scanf("%d",&n);k=0;for(i=0;i<n;i++)scanf("%d",&a[i]);for(i=0;i<n;i++)scanf("%d",&b[i]);for(i=0;i<n;i++)if(a[i]+b[i]>10)k++;printf("Case %d: %d\n",p++,k);}}
- c
- c
- c
- c
- C
- c
- c
- c
- C+
- c
- C
- c
- c
- c
- C
- C
- c
- C
- Android逆向之旅---Native层的Hook神器Cydia Substrate使用详解
- 企业招聘程序员,最看重的5个方面
- C语言贪吃蛇
- 设计模式汇总
- mybatis foreach多次遍历问题
- C
- Fetch / ajax 不能获取response中的所有headers的解决方法(适用nginx)
- 括号的匹配问题
- Spring核心概念<二>:AOP面向切面编程
- cvc-complex-type.2.3: Element 'web-app' cannot have character [children], because the type's content
- mybatis
- Android窗口管理分析(1):View如何绘制到屏幕上的主观理解
- OpenCV Error: Unspecifiederror 解决
- Linux 运维面试笔试