190152025-11-17 11:53:11CWMHullámvasút építéscpp17Forditási hiba
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int tmax = 0;
    int tcur = 0;
    int tmin = 1;
    if (s[0] == 'H') cout << 1;
    else cout << 0;
    return;
    for (size_t i = 0; i < n; i++)
    {
        if (s[i] == 'D') {
            tcur += 9;
            tmax += 9;
        }
        if (s[i] == 'U') {
            tcur -= 11;
            tmax -= 11;
            if (tmin > tcur) {
                tmin = tcur;
            }
            if (tmax <= 0) {
                cout << -1;
                return 0;
            }
        }
        if (s[i] == 'H') {
            tmax += 10;
        }
        if (s[i] == 'B') {
            tcur += 10;
            tmax += 10;
        }
    }
    if (tmin == 1) cout << 0;
    else cout << -tmin / 10 + 1;
    return 0;
}
Forditási hiba
open /var/local/lib/isolate/425/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:18:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   18 |     return;
      |     ^~~~~~