zoukankan      html  css  js  c++  java
  • 2的倍数规律

    http://codeforces.com/gym/101061/problem/A

    题意:两个盒子,从1开始,取当前未取的最小值x放入First box ,2*x放入Second box。

    1、1 3 4  5  7

    2、2 6 8 10 14

    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    #include <iostream>
    #include <algorithm>
    #include <iostream>
    #include <cstdio>
    #include <string>
    #include <cstring>
    #include <stdio.h>
    #include <queue>
    #include <string.h>
    #include <vector>
    #include <map>
    #define ME(x , y) memset(x , y , sizeof(x))
    #define SF(n) scanf("%d" , &n)
    #define rep(i , n) for(int i = 0 ; i < n ; i ++)
    #define INF  0x3f3f3f3f
    #define mod 1000000007
    using namespace std;
    typedef long long ll ;
    
    
    
    int main()
    {
        int t ;
        scanf("%d" , &t);
        while(t--)
        {
            ll n , ans = 0 ;
            scanf("%lld" , &n);
            if(n % 2 == 1)
            {
                printf("First Box
    ");
            }
            else
            {
                while(n % 2 == 0)
                {
                    n /= 2 ;
                    ans ++ ;
                }
                if(ans % 2 == 1)
                    printf("Second Box
    ");
                else
                    printf("First Box
    ");
            }
    
        }
    
        return 0 ;
    }
  • 相关阅读:
    Mybatis学习笔记
    Java——设计模式
    Java——多线程
    Java——集合
    DAO层、Service层、Controller层、View层
    Mybatis整合spring
    Spring中的DI和IOC
    事务
    Xml实现AOP
    2018.3.10考试的试题解析
  • 原文地址:https://www.cnblogs.com/nonames/p/11379384.html
Copyright © 2011-2022 走看看