• 2015 HIAST Collegiate Programming Contest B


    New Job

    题意:将一个文件复制到n台电脑上,但是只有m条网线,每台电脑一次只能连接一根网线,输出多少时间可以完成复制

    思路:xjb模拟

    AC代码:

    #include "iostream"
    #include "string.h"
    #include "stack"
    #include "queue"
    #include "string"
    #include "vector"
    #include "set"
    #include "map"
    #include "algorithm"
    #include "stdio.h"
    #include "math.h"
    #define ll long long
    #define bug(x) cout<<x<<" "<<"UUUUU"<<endl;
    #define mem(a) memset(a,0,sizeof(a))
    #define mp(x,y) make_pair(x,y)
    using namespace std;
    const long long INF = 1e18+1LL;
    const int inf = 1e9+1e8;
    const int N=1e5+100;
    ///BBBB
    
    ll n,m;
    int main(){
        int t;
        cin>>t;
        while(t--){
            ll ans=0;
            cin>>n>>m;
            ll g=1;
            while(n>0){
                if(g>=m){
                    g=m;
                    ans+=(n/m);
                    if(n%m) ans++;
                    break;
                }
                ans++;
                n-=g;
                g<<=1;
            }
            cout<<ans<<endl;
        }
        return 0;
    }
  • 相关阅读:
    Jenkins 插件管理
    持续集成 目录
    gitlab 目录
    jenkins 目录
    POJ 2828
    POJ 2782
    POJ 2725
    POJ 2769
    POJ 2739
    POJ 2707
  • 原文地址:https://www.cnblogs.com/max88888888/p/7161678.html
Copyright © 2020-2023  润新知