30pts,TLE+WA求调
查看原帖
30pts,TLE+WA求调
953149
DoubleQLzn楼主2024/7/23 20:36

rt

记录:https://www.luogu.com.cn/record/168095371

代码:

#include <bits/stdc++.h>
using namespace std;
string strin[100005],strout[100005];
int k[100005];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int s = 0;
	string a,kzm1,kzm2,in,out,name;
	int num = 0;
	cin >> a;
	if (a != "1") cin >> kzm2;
	while (cin >> in >> out) 
	{
		s++;
      //举个例子:a=1,ans.in1,ans.out1
		if (a == "1")
		{
			while (!(in[0] >= '0' && in[0] <= '9'))
			{
				strin[s].push_back(in[0]);
				in.erase(0,1);
			}	
          //算的是ans.in
			while (!(out[0] >= '0' && out[0] <= '9'))
			{
				strout[s].push_back(out[0]);
				out.erase(0,1);
			}	
          //算的是ans.out
			while (!in.empty())
			{
				k[s] = k[s] * 10 + (in[0] - '0');
				in.erase(0,1);
			}
          //算的是1
		}
	}
	if (a != "1")
	{
      //举个例子enger1.in
		while (!(a[0] >= '0' && a[0] <= '9'))
		{
			name.push_back(a[0]);
			a.erase(0,1);
          //算的是enger
		}
		while (a[0] != '.')
		{
			num = num * 10 + (a[0] - '0');
			a.erase(0,1);
          //算的是1
		} 
		a.erase(0,1);
		kzm1 = a;//算的是in
	}
	if (a == "1")
	{
		for (int i = 1;i <= s;i++)
		{
			if (k[1] == 0) cout << strin[i] << k[i] + 1 << ' ' << strout[i] << k[i] + 1 << endl;
			else cout << strin[i] << k[i] - 1 << ' ' << strout[i] << k[i] - 1 << endl; //-1/+1
		}
	}
	else
	{
		for (int i = 1;i <= s;i++)
		{
			cout << name << num << '.' << kzm1 << ' ' << name << num << '.' << kzm2 << endl; //文件名+数量+.+输入扩展名+文件名+数量+.+输出扩展名
			num++;
		}
	}
	return 0;
}
2024/7/23 20:36
加载中...