0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-08 15:18:46 +00:00

1347: Unix-head

http://tk.hustoj.com/reinfo.php?sid=1324925
This commit is contained in:
Baoshuo Ren 2021-07-25 19:05:36 +08:00 committed by Baoshuo Ren
parent 6814f5b0e0
commit 36f6186573
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,22 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
getline(cin, s);
vector<string> args;
stringstream ss;
ss << s;
while (ss >> s) {
args.push_back(s);
}
int count = 10;
if (args.size() >= 2) count = -atoi(args[1].c_str());
while (getline(cin, s)) {
if (count-- > 0) {
cout << s << endl;
}
}
return 0;
}