竞赛
考级
#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
邵逸宸
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++
枫岚
共34条