首页 > 其他分享 >C. Team

C. Team

时间:2024-02-29 22:24:50浏览次数:18  
标签:set cout point leading There number Team

This is a chanllenging problem on codeforces with a diffcuilt score of 1400.

It presents a intressting chanllege that can be solved by using the principle of constructive.

point 1:There are no answers if m < n - 1.
point 2:There are no answers if m > (n - 1) * 2

Returning to the constructive part, If m == n - 1, we should set 0 as the leading number of the sequence.Otherwise, we can set 1 as the leading number, followed by 10,until the number of m is equal to the number of n. After that, we simply output 10 until the numbers become 0.

https://codeforces.com/problemset/problem/401/C

void solve(){
    int n, m;
    cin >> n >> m;

    if (m < n - 1 || m > (n + 1) * 2){
        cout << -1 << '\n';
    }
    else if (m == n - 1){
        while (n -- >= 2){
            cout << "01";
        }
        cout << 0;
    }
    else{
        while (n > 0 && m > 0){
            if (m > n){
                cout << "110";
                m -= 2;
                n -= 1;
            }
            else{
                cout << "10";
                m --;
                n --;
            }
        }
        while (m --){
            cout << 1;
        }
    }
}

标签:set,cout,point,leading,There,number,Team
From: https://www.cnblogs.com/yxcblogs/p/18045691

相关文章

  • 分析一个steam假入库行为,附带相关恶意样本
    0x00、前言朋友发来一个图片,说自己买了某宝上steam激活sdk,结果客服发过来一个教程让他下载游戏,想问问我有没有问题。0x01、看了图片后立刻来了兴趣。命令很简单,先是IRM远程访问,然后IEX执行。手动访问了一下cdk.yesilovemyhome.com,发现跳转steam官方商城了https://store.steam......
  • Godot C#接入steam sdk
    视频参考链接:HowididitGodotTutorial-ConnectyourgametoSteam+lobbyserver+Playfab1.下载资源首先使用C#版的godot记得下载.net。下载steamsdk:链接2.创建项目和平常的操作无异,我这里的项目名称是steamsdk。再在项目中添加一个CSharp代码,随便写点什么,比如......
  • Redteam ADCS attack:PTC attack
    Thistextintroduceanewdomainlateralmovementtechnology--PTC(certificatetransportattack).IntroducinganewkindofDCcertificationutilizthinking.Thatis,ifthedomaincontrollerdoesnot supportPKINIT,theLDAPserverusesthecertificatefor......
  • JAVA基础-Steam
    1,OptionalJava8中的Optional是一个可以包含或不可以包含非空值的容器对象。1.1,获取Optional的三个方法1.of(value)返回一个Optional,value不可以为null2.empty()返回一个空的Optional3.ofNullable(value)返回一个Optional,如果value为null,就是empty(),否......
  • SharePoint Online Viva Connections 添加到Teams
    前言我们新建了VivaConnections,然后如何让大家知道呢?Teams入口是一个非常好的方法。正文1.我们选择安装VivaConnections到Teams,如下图:2.这样会弹出安装的步骤,如下图:3.进入Teams管理中心,找到Teamsapps-Setuppolicies,如下图:4.添加一个新......
  • 如何把SharePoint Online站点添加到Teams
    前言最近,用户有个需求,用户希望把已经有的SharePointOnline站点添加到Teams里,方便后续的维护。正文1.进入Office365管理中心,找到Admin,如下图:2.找到SharePoint管理中心(如果没有需要点一下...showall),如下图:3.选中需要添加Teams的站点,点击AddTeam......
  • Linux之bond 和 team
    一、bond和team区别bond只能是双网卡绑定,team不需要手动加载相应内核模块和有更强的拓展性,最高可以绑定8块网卡。二、模式bond模式(1)mode=0(balance-rr)(平衡轮循环策略)链路负载均衡,增加带宽,支持容错,一条链路故障会自动切换正常链路。交换机需要配置静态链路聚合。特......
  • 新一代的团队协作平台-Teamlinker
    Teamlinker是一个集成了不同功能和模块的团队协作平台。你可以联系你的团队成员,分配你的任务,开始一个会议,安排各项事务,管理你的文件等。并且支持线下免费部署,功能和线上版本一致。主页对于很多公司来说,他们需要用一个工具来确定项目进度,再用一个工具和其他同事沟通,然后用另一个......
  • HASHTEAM 强网杯 2024 WP
    2023强网杯强网杯疯狂坐牢,pwn做不了一点只能在强网先锋划划水....太菜了,来年再战!CryptoNotonlyrsa开就完了,直接上代码fromCrypto.Util.numberimport*fromtqdmimporttqdmn=6249734963373034215610144758924910630356277447014258270888329547267471837899275103......
  • HASHTEAMn1ctf2023WP
    N1CTF2023排名25,卡线Cryptowarmupnonce有问题数学模型:e=2^128*e1+e2d=2^128*d1+d2nonce=2^128*e1+d1s=(e+rd)/noncemodn展开s2128*e1+s*d1=2128e1+e2+r(2^128d1+d2)modn(s-1)2128*e1+(s-r*2128)d1-r*d2-e2==0modn造格子注意到d最高2^255一定为1,卡下界SM4......