Submission #1780887
Source Code Expand
#include <cstdio>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <utility>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
const int iinf = 1 << 29;
const long long linf = 1ll << 61;
#define modp(x, y) (((y) + (x) % (y)) % (y))
struct st
{
int a, b, c;
};
int N, L;
char S[2][53];
int M;
st domino[30];
int main(int argc, char* argv[])
{
scanf("%d", &N);
scanf("%s", S[0]);
scanf("%s", S[1]);
L = strlen(S[0]);
int bef = -1;
ll ans;
for(int i = 0; i < L; i++)
{
if(S[0][i] == S[1][i])
{
if(bef == 0)
{
ans *= 2;
}
else if(bef == -1)
{
ans = 3;
}
bef = 0;
}
else
{
if(bef == 0)
{
ans *= 2;
}
else if(bef == -1)
{
ans = 6;
}
else
{
ans *= 3;
}
bef = 1;
i++;
}
ans %= 1000000007;
}
printf("%lld\n", ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
D - Coloring Dominoes |
User |
neiteng |
Language |
C++14 (GCC 5.4.1) |
Score |
400 |
Code Size |
1157 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
128 KB |
Compile Error
./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:40:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &N);
^
./Main.cpp:41:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s", S[0]);
^
./Main.cpp:42:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s", S[1]);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
400 / 400 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample1.txt, sample2.txt, sample3.txt |
All |
sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name |
Status |
Exec Time |
Memory |
1.txt |
AC |
1 ms |
128 KB |
10.txt |
AC |
1 ms |
128 KB |
11.txt |
AC |
1 ms |
128 KB |
12.txt |
AC |
1 ms |
128 KB |
13.txt |
AC |
1 ms |
128 KB |
14.txt |
AC |
1 ms |
128 KB |
15.txt |
AC |
1 ms |
128 KB |
16.txt |
AC |
1 ms |
128 KB |
17.txt |
AC |
1 ms |
128 KB |
18.txt |
AC |
1 ms |
128 KB |
19.txt |
AC |
1 ms |
128 KB |
2.txt |
AC |
1 ms |
128 KB |
20.txt |
AC |
1 ms |
128 KB |
21.txt |
AC |
1 ms |
128 KB |
22.txt |
AC |
1 ms |
128 KB |
3.txt |
AC |
1 ms |
128 KB |
4.txt |
AC |
1 ms |
128 KB |
5.txt |
AC |
1 ms |
128 KB |
6.txt |
AC |
1 ms |
128 KB |
7.txt |
AC |
1 ms |
128 KB |
8.txt |
AC |
1 ms |
128 KB |
9.txt |
AC |
1 ms |
128 KB |
sample1.txt |
AC |
1 ms |
128 KB |
sample2.txt |
AC |
1 ms |
128 KB |
sample3.txt |
AC |
1 ms |
128 KB |