L1-070 吃火鍋 分數 15

Frodnx發表於2024-08-16
foundPos == std::string::npos // 說明沒有查詢到
// 9'15"
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int cnt = 0, first = 0, potcnt = 0;
    while(getline(cin,s))
    {
        if(s == ".") break;
        ++ cnt;
        if(s.find("chi1 huo3 guo1", 0) != string::npos)
        	first = (potcnt ++ == 0 ? cnt : first);
    }
    cout << cnt << endl;
    if(potcnt == 0) cout << "-_-#";
    else cout << first << " " << potcnt;
    return 0;
}

相關文章