CSES - Harjoituskisa 14.1.2018 - Results
Submission details
Task:Kasihymiö
Sender:Epe
Submission time:2018-01-14 21:02:53 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#1ACCEPTED0.10 s1details
#2ACCEPTED0.04 s1details
#30.09 s1details
#40.06 s1details
#50.09 s1details
#6--2details
#7ACCEPTED0.11 s2details
#8--2details
#9--2details
#10--2details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:12:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < s.length(); i++){
                    ^
input/code.cpp:14:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int n = 0; n < s.substr(i).length(); n++){
                     ^

Code

#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main(){
	int c = 0;
	string s;
	cin >> s;
	char ch[s.length()];
	strncpy(ch, s.c_str(), sizeof(ch));
	ch[sizeof(ch) - 1] = 0;
	for (int i = 0; i < s.length(); i++){
		if(ch[i] == '8'){
			for(int n = 0; n < s.substr(i).length(); n++){
				if(ch[n] == ')'){
					c++;
				}
			}
		}
	}
	cout << c << endl;
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
888888888888888888888888888888...

correct output
0

user output
0

Test 2

Group: 1

Verdict: ACCEPTED

input
))))))))))))))))))))))))))))))...

correct output
0

user output
0

Test 3

Group: 1

Verdict:

input
888888888888888888888888888888...

correct output
250000

user output
125249

Test 4

Group: 1

Verdict:

input
8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)...

correct output
125250

user output
125249

Test 5

Group: 1

Verdict:

input
8)88))))88))8)))8))8))888))888...

correct output
127050

user output
125194

Test 6

Group: 2

Verdict:

input
888888888888888888888888888888...

correct output
0

user output
(empty)

Test 7

Group: 2

Verdict: ACCEPTED

input
))))))))))))))))))))))))))))))...

correct output
0

user output
0

Test 8

Group: 2

Verdict:

input
888888888888888888888888888888...

correct output
250000000000

user output
(empty)

Test 9

Group: 2

Verdict:

input
8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)...

correct output
125000250000

user output
(empty)

Test 10

Group: 2

Verdict:

input
888)888))8)88)8))88)888)88))8)...

correct output
125162819188

user output
(empty)