답안 #643149

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
643149 2022-09-21T10:25:22 Z mychecksedad Homework (CEOI22_homework) C++17
0 / 100
32 ms 12632 KB
/* Author : Mychecksdead */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define PI 3.1415926535
#define pb push_back
#define setp() cout << setprecision(15)
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " is " << x << '\n';
const int N = 1e6+100, M = 1e5+10, F = 2147483646, K = 20;


string s;
void solve  (){
    cin >> s;
    int n = 0, a = 0, b = 0;
    for(int i = 0; i < s.length(); ++i){
        if(i + 2 < s.length()) if(s[i] == 'm' && s[i + 1] == 'i' && s[i + 2] == 'n') a++;
        if(i + 2 < s.length()) if(s[i] == 'm' && s[i + 1] == 'a' && s[i + 2] == 'x') b++;
        if(s[i] == '?') n++;
    }
    cout << n - max(a, b);
}





int main(){
    cin.tie(0); ios::sync_with_stdio(0);
    int T = 1, aa;
    // cin >> T;aa=T;
    while(T--){
        // cout << "Case #" << aa-T << ": ";
        solve();
        cout << '\n';
    }
    return 0;
 
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i = 0; i < s.length(); ++i){
      |                    ~~^~~~~~~~~~~~
Main.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         if(i + 2 < s.length()) if(s[i] == 'm' && s[i + 1] == 'i' && s[i + 2] == 'n') a++;
      |            ~~~~~~^~~~~~~~~~~~
Main.cpp:22:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if(i + 2 < s.length()) if(s[i] == 'm' && s[i + 1] == 'a' && s[i + 2] == 'x') b++;
      |            ~~~~~~^~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:34:16: warning: unused variable 'aa' [-Wunused-variable]
   34 |     int T = 1, aa;
      |                ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 12048 KB Output is correct
2 Correct 26 ms 12632 KB Output is correct
3 Incorrect 32 ms 12224 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -