B2051 点和正方形的关系
难度:入门
如果 x<−1|x>1||y<−1||y>1 ,那么点就在正方形外,反之亦然
AC代码:
#include <iostream>
using namespace std;
int main()
{
#define int long long
int x,y;
cin>>x>>y;
if(x>=-1&&x<=1&&-1<=y&&y<=1)
{
cout<<"yes"<<endl;
}
else
{
cout<<"no"<<endl;
}
return 0;
}
B2067 药房管理
难度:入门+
for循环+分支结构+数学运算
AC代码:
#include <iostream>
using namespace std;
int main()
{
int m, n;
cin>>m;
cin>>n;
int r=0;
int c=m;
for(int i=0;i<n;i++)
{
int r2;
cin>>r2;
if(r2<=c)
{
c-=r2;
}
else
{
r++;
}
}
cout<<r;
return 0;
}
P10125 「Daily OI Round 3」Simple
P10125 「Daily OI Round 3」Simple - 洛谷
难度:入门+ —— 普及-
一道比赛中很不常见的简单签到题
string+for循环+分支
第一步是把大写转小写
第二步就是判断啦
然后就完工了……(*^_^*)
AC代码:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;
int main()
{
string n;
cin>>n;
for(int i=0;i<n.size();i++)
{
if(n[i]>='A'&&n[i]<='Z')
{
n[i]+=32;
}
}
if(n=="svpoll")
{
cout<<"Genshin";
}
else if(n=="acoipp")
{
cout<<"Luogu";
}
else
{
cout<<"Boring";
}
return 0;
}
P10029 「Cfz Round 3」Battle
P10029 「Cfz Round 3」Battle - 洛谷
难度:入门+ —— 普及-
签到题!(*^_^*)
直接判断即可
AC代码:
#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,p,m;
cin>>n>>m>>p;
if(m<p)
{
cout<<"Alice"<<endl;
}
else
{
if(n<p)
{
cout<<"Bob"<<endl;
}
else
{
cout<<"Lasting Battle"<<endl;
}
}
}
return 0;
}
P10056 Water
难度:入门
签到题 ( ̄▽ ̄)"
(a−a) mod b即可
AC代码:
#include <iostream>
using namespace std;
int main()
{
#define int long long
int a,b,n;
cin>>a>>b>>n;
if(b*n<=a)
{
cout<<b*n;
}
else
{
int z=a%b;
cout<<a-z;
}
return 0;
}