제출 #367377

#제출 시각아이디문제언어결과실행 시간메모리
367377bad_in_physicsSifra (COCI21_sifra)C++17
30 / 50
1 ms384 KiB
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

void solve () {
	string arr;
	cin>>arr;
	arr += 'a';
	string ans = "";
	set<string> s;
	for (int i=0; i<arr.length(); i++) {
		if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
			ans += arr[i];
		} else {
			if (ans.length()>0) {
				s.insert(ans);
				ans = "";
			}
		}
	} cout<<s.size();
}

int main(void) {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'void solve()':
Main.cpp:12:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for (int i=0; i<arr.length(); i++) {
      |                ~^~~~~~~~~~~~~
Main.cpp:13:13: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:41: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:55: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:69: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:83: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:97: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:111: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:125: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
#Verdict Execution timeMemoryGrader output
Fetching results...