bnu 29378 Adidas vs Adivon 基础题

 

Adidas vs Adivon

Time Limit:  1000ms
Memory Limit:  65536KB
 
64-bit integer IO format:   %lld       Java class name:   Main
Font Size:   +   -
Type:    None   Graph Theory       2-SAT       Articulation/Bridge/Biconnected Component       Cycles/Topological Sorting/Strongly Connected Component       Shortest Path           Bellman Ford           Dijkstra/Floyd Warshall       Euler Trail/Circuit       Heavy-Light Decomposition       Minimum Spanning Tree       Stable Marriage Problem       Trees       Directed Minimum Spanning Tree       Flow/Matching           Graph Matching               Bipartite Matching               Hopcroft–Karp Bipartite Matching               Weighted Bipartite Matching/Hungarian Algorithm           Flow               Max Flow/Min Cut               Min Cost Max Flow   DFS-like       Backtracking with Pruning/Branch and Bound       Basic Recursion       IDA* Search       Parsing/Grammar       Breadth First Search/Depth First Search       Advanced Search Techniques           Binary Search/Bisection           Ternary Search   Geometry       Basic Geometry       Computational Geometry       Convex Hull       Pick's Theorem   Game Theory       Green Hackenbush/Colon Principle/Fusion Principle       Nim       Sprague-Grundy Number   Matrix       Gaussian Elimination       Matrix Exponentiation   Data Structures       Basic Data Structures       Binary Indexed Tree       Binary Search Tree       Hashing       Orthogonal Range Search       Range Minimum Query/Lowest Common Ancestor       Segment Tree/Interval Tree       Trie Tree       Sorting       Disjoint Set   String       Aho Corasick       Knuth-Morris-Pratt       Suffix Array/Suffix Tree   Math       Basic Math       Big Integer Arithmetic       Number Theory           Chinese Remainder Theorem           Extended Euclid           Inclusion/Exclusion           Modular Arithmetic       Combinatorics           Group Theory/Burnside's lemma           Counting       Probability/Expected Value   Others       Tricky       Hardest       Unusual       Brute Force       Implementation       Constructive Algorithms       Two Pointer       Bitmask       Beginner       Discrete Logarithm/Shank's Baby-step Giant-step Algorithm       Greedy       Divide and Conquer   Dynamic Programming                       Tag it!

“我们坐在高高的土堆上面,听妈妈讲阿迪王的事情。我出生在一个不太普通的家庭,妈妈会预知术,在我小的时候,妈妈就常跟我说:‘在未来的世界,有一种叫阿迪王的东西成为比石油、黄金还重要的东西……’那时,我痴痴地听着,一听就到半夜,听到入迷,任由鼻涕流到自己的嘴里。长大后,我终于知道阿迪王是什么东西。它是对于亿万人来说比自身生命还重要的神物……”

就我所知,一双普通的阿迪王人造革鞋的日常维护费就很惊人了,有些亿万富翁购买了阿迪王的产品后因为不堪负担产品的日常维护费用而宣布个人破产。

“I'm coming!!!”

但是,Adidas这个从来没有听过的牌子居然告Adivon商标侵权了!!这是Adivon粉丝们不能容忍的!!!所以在一个夜黑风高的晚上,一位高贵的Adivon粉丝与另一位Adidas屌丝约战于华山之巅。作为21世纪的新青年,他们选择了智力对抗,来一局博弈定胜负。

他们拿出了一张长和宽都是正整数的纸片,每次,当前一方可以选择将纸片水平或竖直撕成相等的两半(平行于长边或宽边),扔掉一半。但是要求撕完后剩下的那部分纸片长和宽依旧是正整数。直到有一方不能再撕,该方即输掉这场博弈。

Adivon的粉丝那是相当大度的,所以每次都是Adidas屌丝先手。

Input

第一行一个整数N(2<=N<=2000),表示他们进行了多少局博弈。

接下来N行,每行两个正整数L和H(1<=L,H<=1000000),表示该局纸片的初始长宽。

 

Output

对于每一局游戏,输出一行,如果Adivon粉丝胜利则输出"Adivon prevails",否则Adivon粉丝将发动神技,改变游戏结局,此种情况输出"Adidas loses".

 

Sample Input

2
1 2
2 2
 

Sample Output

Adidas loses
Adivon prevails
 

Source

 

 1 /*
 2 
 3 很简单的一道题,只要判断一下,在不断的对半切的过程中
 4 一直/2,直到是一个奇数或者为0.统计次数。
 5 长和宽的次数相加。判断奇偶性就可以了。
 6 
 7 
 8 
 9 */
10 
11 
12 #include<iostream>
13 #include<cstdio>
14 #include<cstring>
15 #include<cstdlib>
16 using namespace std;
17 
18 int f[31]={0,2};
19 
20 int main()
21 {
22     int t,hxl,tom,x,y;
23     while(scanf("%d",&t)>0)
24     {
25         while(t--)
26         {
27             scanf("%d%d",&x,&y);
28             hxl=0;tom=0;//开始,初始化居然被丢了,额。
29             if(x%2==1) hxl=0;
30             else{
31                 while(1)
32                 {
33                     if(x%2==1)break;
34                     hxl++;
35                     x=x/2;
36                 }
37             }
38             if(y%2==1) tom=0;
39             else{
40                 while(1)
41                 {
42                     if(y%2==1)break;
43                     tom++;
44                     y=y/2;
45                 }
46             }
47             hxl=hxl+tom;
48             if(hxl%2==1)
49             {
50                 printf("Adidas loses\n");
51             }
52             else printf("Adivon prevails\n");
53         }
54     }
55     return 0;
56 }

 

转载于:https://www.cnblogs.com/tom987690183/p/3349681.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值