Skip to content

Commit 929b969

Browse files
author
Jessica Yung
committed
feat(usaco): add usaco dir, first two problems
- test problem - first real problem (yourride)
1 parent afe3eba commit 929b969

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
ID: jessica41
3+
PROG: test
4+
LANG: C++
5+
*/
6+
#include <iostream>
7+
#include <fstream>
8+
#include <string>
9+
10+
using namespace std;
11+
12+
int main() {
13+
ofstream fout ("test.out");
14+
ifstream fin ("test.in");
15+
int a, b;
16+
fin >> a >> b;
17+
fout << a+b << endl;
18+
return 0;
19+
}
20+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
ID: jessica41
3+
PROG: ride
4+
LANG: C++11
5+
*/
6+
#include <iostream>
7+
#include <fstream>
8+
#include <algorithm>
9+
#include <string>
10+
11+
using namespace std;
12+
13+
int main() {
14+
ofstream fout ("ride.out");
15+
ifstream fin ("ride.in");
16+
string comet_name, group_name;
17+
int comet_prod = 1;
18+
int group_prod = 1;
19+
fin >> comet_name >> group_name;
20+
//cin >> comet_name >> group_name;
21+
cout << "comet_name: " << comet_name << endl;
22+
cout << "group_name: " << group_name << endl;
23+
string outcome;
24+
transform(comet_name.begin(), comet_name.end(), comet_name.begin(), ::tolower);
25+
transform(group_name.begin(), group_name.end(), group_name.begin(), ::tolower);
26+
for (int i = 0; i < group_name.size(); ++i) {
27+
group_prod *= int(group_name[i])%96;
28+
}
29+
for (int i = 0; i < comet_name.size(); ++i) {
30+
comet_prod *= int(comet_name[i])%96;
31+
}
32+
cout << "comet_prod: " << comet_prod << endl;
33+
cout << "group_prod: " << group_prod << endl;
34+
if (group_prod % 47 == comet_prod % 47) {
35+
outcome = "GO";
36+
}
37+
else {
38+
outcome = "STAY";
39+
}
40+
fout << outcome << endl;
41+
cout << outcome << endl;
42+
return 0;
43+
}
44+
30.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)