Task: | Peg |
Sender: | untokarila |
Submission time: | 2019-07-29 14:04:28 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.01 s | details |
#6 | ACCEPTED | 0.01 s | details |
Code
#include <iostream> using namespace std; char d[7][7]; bool diff(char a, char b){ return (a == '.' && b == 'o') || (b == '.' && a == 'o'); } int main(){ for(int i=0; i<7; i++){ for(int j=0; j<7; j++){ if((i<2 || i>4) && (j<2 || j>4)) continue; cin >> d[i][j]; } } int ans = 0; for(int i=0; i<7; i++){ for(int j=0; j<7; j++){ if(d[i][j] != 'o') continue; if(i>0 && i<6 && diff(d[i-1][j], d[i+1][j])) ans++; if(j>0 && j<6 && diff(d[i][j-1], d[i][j+1])) ans++; } } cout << ans; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
o.o
.o. o.ooo.o .oo.oo. o.ooo.o ... |
correct output |
---|
16 |
user output |
---|
16 |
Test 2
Verdict: ACCEPTED
input |
---|
...
o.o .ooooo. ..o.o.. .ooooo. ... |
correct output |
---|
8 |
user output |
---|
8 |
Test 3
Verdict: ACCEPTED
input |
---|
oo.
.oo .oo.oo. o.oo.oo oo.oo.o ... |
correct output |
---|
26 |
user output |
---|
26 |
Test 4
Verdict: ACCEPTED
input |
---|
...
..o ....... ....... ....... ... |
correct output |
---|
0 |
user output |
---|
0 |
Test 5
Verdict: ACCEPTED
input |
---|
o.o
oo. o...o.. oo.o..o .oo.oo. ... |
correct output |
---|
13 |
user output |
---|
13 |
Test 6
Verdict: ACCEPTED
input |
---|
.oo
.oo oo.o.oo o...... oo.oo.o ... |
correct output |
---|
11 |
user output |
---|
11 |