forked from SharmaManish/Spoj
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMCOINS.cpp
More file actions
45 lines (31 loc) · 726 Bytes
/
Copy pathMCOINS.cpp
File metadata and controls
45 lines (31 loc) · 726 Bytes
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
#include<iostream>
#include<stdio.h>
using namespace std;
int wl[1000001];
int main()
{
int k,l,m;
scanf("%d%d%d",&k,&l,&m);
wl[0]=0;
for(int i=1;i<=1000000;i++)
{
if(wl[i-1]==0)
wl[i]=1;
else if((i-k)>=0 && wl[i-k]==0)
wl[i]=1;
else if((i-l)>=0 && wl[i-l]==0)
wl[i]=1;
}
long y;
for(int i=0;i<m;i++)
{
scanf("%ld",&y);
if(wl[y])
printf("A");
else
printf("B");
}
printf("\n");
system ("pause");
return 0;
}