boj step 6 rework
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -9,4 +9,7 @@ venv
|
||||
.ipynb_checkpoints
|
||||
|
||||
__init__.py
|
||||
**/test_*.py
|
||||
**/test_*.py
|
||||
|
||||
*.exe
|
||||
a.out
|
||||
52
zeta_cpp/completed/25206.cpp
Normal file
52
zeta_cpp/completed/25206.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include<iostream>
|
||||
|
||||
double convert_grade(const std::string &g);
|
||||
|
||||
int main() {
|
||||
double sum_of_score = 0;
|
||||
double sum_of_prod_score_grade = 0;
|
||||
for (int i = 0; i < 20; i++) {
|
||||
std::string category;
|
||||
double score;
|
||||
std::string grade;
|
||||
std::cin >> category >> score >> grade;
|
||||
double s_grade = convert_grade(grade);
|
||||
if (s_grade < 0) {
|
||||
continue;
|
||||
} else {
|
||||
sum_of_score += score;
|
||||
sum_of_prod_score_grade += score * s_grade;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
std::cout << sum_of_prod_score_grade / sum_of_score;
|
||||
return 0;
|
||||
}
|
||||
|
||||
double convert_grade(const std::string &g) {
|
||||
if (g == "A+") {
|
||||
return 4.5;
|
||||
} else if (g == "A0") {
|
||||
return 4.0;
|
||||
} else if (g == "B+") {
|
||||
return 3.5;
|
||||
} else if (g == "B0") {
|
||||
return 3.0;
|
||||
} else if (g == "C+") {
|
||||
return 2.5;
|
||||
} else if (g == "C0") {
|
||||
return 2.0;
|
||||
} else if (g == "D+") {
|
||||
return 1.5;
|
||||
} else if (g == "D0") {
|
||||
return 1.0;
|
||||
} else if (g == "F") {
|
||||
return 0.0;
|
||||
} else {
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
6
zeta_python/completed/25083.py
Normal file
6
zeta_python/completed/25083.py
Normal file
@@ -0,0 +1,6 @@
|
||||
print(""" ,r'"7
|
||||
r`-_ ,' ,/
|
||||
\. ". L_r'
|
||||
`~\/
|
||||
|
|
||||
|""")
|
||||
10
zeta_python/completed/3003.py
Normal file
10
zeta_python/completed/3003.py
Normal file
@@ -0,0 +1,10 @@
|
||||
chess_set = [1, 1, 2, 2, 2, 8, ]
|
||||
|
||||
my_set = list(map(int, input().split()))
|
||||
|
||||
delta_set = []
|
||||
|
||||
for u, v in zip(chess_set, my_set):
|
||||
delta_set.append(u - v)
|
||||
|
||||
print(" ".join(map(str, delta_set)))
|
||||
Reference in New Issue
Block a user