提出 #1548061
ソースコード 拡げる
#include <stdio.h>
#define MAX_N 52
#define MOD 1000000007
int main(){
int N,i = 0;
long long int ans;
char s1[MAX_N], s2[MAX_N];
int before;
scanf("%d", &N);
scanf("%s", s1);
scanf("%s", s2);
if(s1[i] == s2[i]){
ans = 3;
before = 0;
i += 1;
} else {
ans = 6;
before = 1;
i += 2;
}
while(i < N){
if(s1[i] == s2[i]){
if(before == 0){
ans = (ans*2) % MOD;
} else {
ans = (ans*1) % MOD;
}
before = 0;
i += 1;
} else {
if(before == 0){
ans = (ans*2) % MOD;
} else {
ans = (ans*3) % MOD;
}
before = 1;
i += 2;
}
}
printf("%lld\n", ans);
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Coloring Dominoes |
| ユーザ | ponntuu3 |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 400 |
| コード長 | 676 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 128 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:12:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &N);
^
./Main.cpp:13:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s", s1);
^
./Main.cpp:14:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s", s2);
^
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| 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 |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 1.txt | AC | 1 ms | 128 KiB |
| 10.txt | AC | 1 ms | 128 KiB |
| 11.txt | AC | 1 ms | 128 KiB |
| 12.txt | AC | 1 ms | 128 KiB |
| 13.txt | AC | 1 ms | 128 KiB |
| 14.txt | AC | 1 ms | 128 KiB |
| 15.txt | AC | 1 ms | 128 KiB |
| 16.txt | AC | 1 ms | 128 KiB |
| 17.txt | AC | 1 ms | 128 KiB |
| 18.txt | AC | 1 ms | 128 KiB |
| 19.txt | AC | 1 ms | 128 KiB |
| 2.txt | AC | 1 ms | 128 KiB |
| 20.txt | AC | 1 ms | 128 KiB |
| 21.txt | AC | 1 ms | 128 KiB |
| 22.txt | AC | 1 ms | 128 KiB |
| 3.txt | AC | 1 ms | 128 KiB |
| 4.txt | AC | 1 ms | 128 KiB |
| 5.txt | AC | 1 ms | 128 KiB |
| 6.txt | AC | 1 ms | 128 KiB |
| 7.txt | AC | 1 ms | 128 KiB |
| 8.txt | AC | 1 ms | 128 KiB |
| 9.txt | AC | 1 ms | 128 KiB |
| sample1.txt | AC | 1 ms | 128 KiB |
| sample2.txt | AC | 1 ms | 128 KiB |
| sample3.txt | AC | 1 ms | 128 KiB |