跳到正文

题解

题解:P10397 『STA - R5』5k.sync.closer

zhangzirui66约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年5月2日
收录
2025年12月12日
更新
2026年11月14日
篇幅
约 1 分钟
获赞
3
题目
P10397

版本

  1. v1当前

一道十分简单的题。

我们观察发现,std::freopen 语句前必定会有 std::freopen(", 而它以后一直到下一个引号就是文件名,可以用 while 循环找出。

代码:

C++
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
    int t;
    cin >> t;
    while(t --){
        char a = 34;//引号的ASCLL码
        string ans;
        cin >> s;
        int i = 14;//std::freopen(" 长15个字符,而字符串是从0开始的,要减1
        while(s[i] != a){
            ans += s[i];
            i ++;
        }
        cout << ans << "\n";
    }
    return 0;
}
原文