- Copycat
时间限制:1000 ms
内存限制:256 MiB
输入文件:copycat.in
输出文件:copycat.out
题目类型:传统
评测方式:文本比较
题目描述
用于测试文件输入输出,请注意使用文件输入输出,而非标准输入输出。
输入一个正整数 ,输出这 个数 。
输入格式
第一行一个正整数 ,表示有 组测试数据。
接下来 行,每行一个正整数 。
输出格式
输出 行,每行一个正整数 。
样例
样例输入1
copycat.in
3
1
2
3
样例输出 1
copycat.out
1
2
3
样例输入2
copycat.in
1
1000000000000000000000000000000000
样例输出 2
copycat.out
1000000000000000000000000000000000
数据范围与提示
对于所有测试点,。
子任务 1(10 分);
子任务 2(20 分);
子任务 3(70 分)没有附加限制。
提交前请选择代码语言
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int n;
int main()
{
cin >> n;
vector<string> s;
while (n--)
{
string t;
cin >> t;
s.push_back(t);
}
for (int i = 0; i < s.size(); ++i)
{
cout << s[i] << endl;
}
return 0;
}
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
const char *in_filename = "copycat.in";
const char *out_filename = "copycat.out";
ifstream in_file(in_filename);
if (!in_file)
{
cerr << "failed to open " << in_filename << '\n';
return 1;
}
ofstream out_file(out_filename);
if (!out_file)
{
cerr << "failed to open " << out_filename << '\n';
return 2;
}
int n;
in_file >> n;
for (int i = 0; i < n; i++)
{
string str;
in_file >> str;
out_file << str << '\n';
}
return 0;
}