竞赛
考级
zsy
#include<iostream> using namespace std; int main(){ }
杨.无敌.编程王者.C++.乔宇
嘉陵江的晚风.
对于鸡兔同笼,需要考虑2种情况: 1.脚的数量不能超过头数量的4倍(腿不能比全是兔子的情况还要多); 2.脚的数量不能少于头数量的2倍(腿不能比全是鸡的情况还要少); 3.第三个else if()语句就不多说了,用来混测试点的。
毛奕程
庞文昊
有事找大号
通过列方程组,设兔子有t只,鸡有j只,则可以得方程组如图 方程组解如图 其中,当t和j皆为整数时且t>0,j>0时成立 代码解题如下
189****0370
#include<bits/stdc++.h> using namespace std; int main (){ int x,y; cin>>x>>y; if(y%20&&(y-2x)>=0&&(y-2x)%20) cout<<"Yes"; return 0; }
195****2471
x,y=map(int,input().split()) if (y-2x)%2==0 and (y-2x)>=0 : print("Yes") else: print("No")
135****1834
#include <iostream> using namespace std; int main(){ int x, y; cin >> x >> y; if (y%2==0 && y<=x4 && y>=x2){ cout << "Yes"; }else{ cout << "No"; } return 0; }
Ferrari F1 Team
枫岚
LS_YZY
138****3765
邵逸宸
#include<bits/stdc++.h> using namespace std; int main(){ long long x,y; cin >> x >> y; if(y % 2 == 0){ if(x * 2 <= y && x * 4 >= y){ cout << "Yes"; }else{ cout << "No"; } }else{ cout << "No"; } return 0; }
张莫言
#include<bits/stdc++.h> using namespace std; int main(){ int x,y,j,t; cin>>x>>y; j=(4x-y)/2; t=x-j; if(j<=0||t<=0){ cout<<"No"; return 0; } if(2j+4*t==y){ cout<<"Yes"; } else cout<<"No"; return 0; }
150****1090
#include <iostream> using namespace std; int main(){ int x,y; cin>>x>>y; int t=(y-x2)/2; int j=x-t; if(j2+t*4y && j>=0 && xj+t && t>=0){ cout<<"Yes"; }else{ cout<<"No"; } }
神
#include <bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a>>b; if(b%2==0&&a * 4>=b&&a*2<=b)cout<<"Yes"; else cout<<"No"; return 0; }
138****7867
#include<iostream> using namespace std; int main(){ int x,y; cin>>x>>y; if(y%2!=0)cout<<"No"; else if(x2>y)cout<<"No"; else if(x4<y)cout<<"No"; else cout<<"Yes"; return 0; }
C++的海浪拍死我吧
共42条