题解 P5315 【头像上传】
这道题数据范围也比较小,所以直接模拟就好了
如果图片的任何一边长度超过了
while(w>g || h>g) //若两边有一边大于g
{
w/=2;
h/=2; //两边同时减半
}
如果图片有任何一边小于 LL,请输出 "Too Young"
if(w<l || h<l)
{
cout<<"Too Young"<<endl;
}
如果图片满足大小条件但不为正方形,请输出"Too Simple"
else if(w!=h)
{
cout<<"Too Simple"<<endl;
}
如果图片满足大小条件并且是正方形,请输出"Sometimes Naive"
else cout<<"Sometimes Naive"<<endl;
所以只要对每一个
#include <bits/stdc++.h>
using namespace std;
int n,l,g,w,h;
int main()
{
int i,j;
cin>>n>>l>>g;
for(i=1;i<=n;i++)
{
cin>>w>>h;
while(w>g || h>g)
{
w/=2;
h/=2;
}
if(w<l || h<l)
{
cout<<"Too Young"<<endl;
}
else if(w!=h)
{
cout<<"Too Simple"<<endl;
}
else cout<<"Sometimes Naive"<<endl;
}
return 0;
}