Advertisement

ICPC 2019 Nanjing H. Prince & Princess

阅读量:

2019 ICPC南京 H. Prince and Princess

题意:王子询问房间找公主。

逻辑推理与特殊情况处理

复制代码
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    int a,b,c; cin>>a>>b>>c;
    if(a==1 && b==0 && c==0){
        puts("YES");
        printf("0\n");
        return 0;
    }
    if(a>b+c){
        puts("YES");
        printf("%d\n",2*(b+c)+1);
    }
    else{
        puts("NO");
    }
    return 0;
    }
    
    
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
    

全部评论 (0)

还没有任何评论哟~