竞赛
考级
#include<iostream> using namespace std; int main(){ }
杨.无敌.编程王者.C++.乔宇
嘉陵江的晚风.
对于鸡兔同笼,需要考虑2种情况: 1.脚的数量不能超过头数量的4倍(腿不能比全是兔子的情况还要多); 2.脚的数量不能少于头数量的2倍(腿不能比全是鸡的情况还要少); 3.第三个else if()语句就不多说了,用来混测试点的。
毛奕程
庞文昊
有事找大号
#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
通过列方程组,设兔子有t只,鸡有j只,则可以得方程组如图 方程组解如图 其中,当t和j皆为整数时且t>0,j>0时成立 代码解题如下
189****0370
#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; }
巴伐利亚蓝天白云
138****3765
枫岚
邵逸宸
LS_YZY
#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; }
蓝遇return
x,y=map(int,input().split()) if (y-2x)%2==0 and (y-2x)>=0 : print("Yes") else: print("No")
135****1834
#include <bits/stdc++.h> using namespace std; int main(){ int ji=0,tu=0,a,b; cin >> a >> b; tu+=(b-a2)/2; ji+=a-tu; if(ji<0 || tu<0){ cout << "No"; return 0; } if(ji2+tu*4==b ){ cout << "Yes"; }else{ cout << "No" ; } return 0; }
还没想好
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll j,t; ll x,y; int main() { cin>>x>>y; t=(y-2x)/2; j=x-t; if(t<0 or j<0){ cout<<"No"; return 0; } if(j2+t*4==y) cout<<"Yes"; else cout<<"No"; return 0; }
黄厚泽(最强和平管理者)C++
共38条