Submission #654986

#TimeUsernameProblemLanguageResultExecution timeMemory
654986_Knyaz_Aron (COCI17_aron)C++17
50 / 50
1 ms236 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll #define all(x) (x).begin(),(x).end() const int mod = 1e9+7; const double PI = acos( -1. ); void in(){ freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); } void solve(){ //in(); int n; cin >> n; char a; cin >> a; int ans = 2; for(int i = 1; i < n; i++){ char c; cin >> c; if(c == a) continue; else{a = c; ans++;} } cout << ans; } signed main(){ cin.tie(0)->sync_with_stdio(0); int t; t = 1; //cin >> t; while(t--) solve(); } /* ██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ███████╗ ██║ ██╔╝████╗ ██║╚██╗ ██╔╝██╔══██╗╚══███╔╝ █████╔╝ ██╔██╗ ██║ ╚████╔╝ ███████║ ███╔╝ ██╔═██╗ ██║╚██╗██║ ╚██╔╝ ██╔══██║ ███╔╝ ███████╗██║ ██╗██║ ╚████║ ██║ ██║ ██║███████╗███████╗ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ */

Compilation message (stderr)

aron.cpp: In function 'void in()':
aron.cpp:9:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
aron.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...