AtCoder Beginner Contest 055

A

1
2
3
4
5
6
7
8
9
10
11
12
// LUOGU_RID: 173305903
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,x,y;//定义
cin>>n;
x=n*800;//根据n求出x
y=(n/15)*200;//根据n求出y
cout<<x-y<<endl;//最后输出答案
return 0;
}

B

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// LUOGU_RID: 173301778
#include<bits/stdc++.h>
using namespace std;
long long s=1;
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
s*=i;
s%=1000000007;
}
cout<<s;
return 0;
}

C

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// LUOGU_RID: 173302163
#include<bits/stdc++.h>
using namespace std;
long long n,m;
int main()
{
cin>>n>>m;
if(n*2==m)
cout<<n<<endl;
else if(n*2<m)
cout<<n+(m-n*2)/4<<endl;
else
cout<<m/2<<endl;
return 0;
}

D

由于知道前面两个字母代表的动物就可以推导出来结果,因此只需要正常模拟即可。

这里的递推真是学到了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int N=1e6+100;
int n;
int a[N];
int t[N];
int solve(int x,int y)
{
t[1]=x;
t[2]=y;
for(int i=3;i<=n;i++)
{
t[i]=(a[i-1]+t[i-1]+t[i-2])%2;
}
if((t[n]+t[1]+t[2])%2==a[1]&&(t[n-1]+t[n]+t[1])%2==a[n])
{
for(int i=1;i<=n;i++)
{
if(!t[i])
{
cout<<"S";
}
else
{
cout<<"W";
}
}
cout<<'\n';
return 1;
}
else
{
return 0;
}
}
int main()
{
cin>>n;
string s;
cin>>s;
for(int i=1;i<=n;i++)
{
a[i]=(s[i-1]=='x');
}
if(solve(0,0))
{}
else if(solve(1,0))
{}
else if(solve(1,1))
{}
else if(solve(0,1))
{}
else
{
cout<<-1<<'\n';
}
return 0;
}

PS:一道有趣题+三道签到题。