restructure zeta/** to storage/zeta/**
This commit is contained in:
6
storage/zeta/cpp/completed/1000.cpp
Normal file
6
storage/zeta/cpp/completed/1000.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include<iostream>
|
||||
int main() {
|
||||
int A, B;
|
||||
std::cin >> A >> B;
|
||||
std::cout << A+B;
|
||||
}
|
||||
6
storage/zeta/cpp/completed/1001.cpp
Normal file
6
storage/zeta/cpp/completed/1001.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include<iostream>
|
||||
int main() {
|
||||
int A, B;
|
||||
std::cin >> A >> B;
|
||||
std::cout << A-B;
|
||||
}
|
||||
29
storage/zeta/cpp/completed/10101.cpp
Normal file
29
storage/zeta/cpp/completed/10101.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int sides[3];
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
cin >> sides[i];
|
||||
}
|
||||
|
||||
if (sides[0] + sides[1] + sides[2] != 180) {
|
||||
cout << "Error";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sides[0] == 60 and sides[1] == 60 and sides[2] == 60) {
|
||||
cout << "Equilateral";
|
||||
return 0;
|
||||
}
|
||||
if (sides[0] == sides[1] or sides[0] == sides[2] or sides[1] == sides[2]) {
|
||||
cout << "Isosceles";
|
||||
return 0;
|
||||
}
|
||||
|
||||
cout << "Scalene";
|
||||
return 0;
|
||||
|
||||
}
|
||||
35
storage/zeta/cpp/completed/10798.cpp
Normal file
35
storage/zeta/cpp/completed/10798.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
vector<string> S;
|
||||
string temp;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
cin >> temp;
|
||||
S.push_back(temp);
|
||||
}
|
||||
|
||||
|
||||
bool is_fin = false;
|
||||
bool flag = false;
|
||||
int j = 0;
|
||||
while (!is_fin) {
|
||||
flag = false;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (S[i].length() <= j) {
|
||||
is_fin = is_fin;
|
||||
continue;
|
||||
}
|
||||
flag = true;
|
||||
cout << S[i][j];
|
||||
|
||||
}
|
||||
|
||||
if (!flag) is_fin = true;
|
||||
j++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
41
storage/zeta/cpp/completed/11005.cpp
Normal file
41
storage/zeta/cpp/completed/11005.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
char translate(int c) {
|
||||
if (0 <= c && c <= 9) {
|
||||
return 48 + c;
|
||||
} else {
|
||||
return 55 + c;
|
||||
}
|
||||
}
|
||||
|
||||
vector<char> calculate(int N, int B) {
|
||||
vector<int> S(0);
|
||||
while (N >= B) {
|
||||
S.push_back(N % B);
|
||||
N /= B;
|
||||
|
||||
}
|
||||
S.push_back(N % B);
|
||||
reverse(S.begin(), S.end());
|
||||
vector<char> ST(0);
|
||||
for(auto i: S) {
|
||||
ST.push_back(translate(i));
|
||||
}
|
||||
return ST;
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
int N;
|
||||
int B;
|
||||
cin >> N >> B;
|
||||
vector<char> s = calculate(N, B);
|
||||
for(auto i: s) {
|
||||
cout << i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
53
storage/zeta/cpp/completed/1339.cpp
Normal file
53
storage/zeta/cpp/completed/1339.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include<iostream>
|
||||
#include<map>
|
||||
#include<cmath>
|
||||
#include<vector>
|
||||
#include<algorithm>
|
||||
|
||||
bool comp(std::pair<char, int> a, std::pair<char, int> b);
|
||||
|
||||
int solve(int N, std::string W[]) {
|
||||
|
||||
std::map<char, int> V;
|
||||
|
||||
for (int i = 0; i < N; ++i) {
|
||||
std::string w = W[i];
|
||||
for (int j = 0; j < w.length(); j++) {
|
||||
if (V.find(w[j]) != V.end()) {
|
||||
|
||||
V[w[j]] += (int) pow(10, (double) (w.length() - j - 1));
|
||||
|
||||
} else {
|
||||
V[w[j]] = (int) pow(10, (double) (w.length() - j - 1));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::pair<char, int>> v(V.begin(), V.end());
|
||||
|
||||
sort(v.begin(), v.end(), comp);
|
||||
int s = 0;
|
||||
for (int i = 0; i < v.size(); i++) {
|
||||
s += (9 - i) * v[i].second;
|
||||
}
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
bool comp(std::pair<char, int> a, std::pair<char, int> b) {
|
||||
return a.second > b.second;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
int N;
|
||||
std::cin >> N;
|
||||
std::string W[N];
|
||||
for (int i = 0; i < N; i++) {
|
||||
std::cin >> W[i];
|
||||
}
|
||||
std::cout << solve(N, W);
|
||||
return 0;
|
||||
}
|
||||
22
storage/zeta/cpp/completed/14215.cpp
Normal file
22
storage/zeta/cpp/completed/14215.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int sides[3];
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
cin >> sides[i];
|
||||
}
|
||||
|
||||
sort(sides, sides + 3);
|
||||
|
||||
if (sides[2] >= sides[1] + sides[0]) {
|
||||
sides[2] = sides[1] + sides[0] - 1;
|
||||
}
|
||||
|
||||
cout << accumulate(sides, sides + 3, 0) << endl;
|
||||
return 0;
|
||||
}
|
||||
30
storage/zeta/cpp/completed/1448.cpp
Normal file
30
storage/zeta/cpp/completed/1448.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int get_max(int N, int *S) {
|
||||
for (int i = 0; i < N - 2; i++) {
|
||||
if (S[i] < S[i + 1] + S[i + 2]) return S[i] + S[i + 1] + S[i + 2];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
int N;
|
||||
int S[1000000];
|
||||
|
||||
cin >> N;
|
||||
|
||||
for (int i = 0; i < N; i++) {
|
||||
cin >> S[i];
|
||||
}
|
||||
|
||||
sort(S, S + N, greater<>());
|
||||
|
||||
cout << get_max(N, S) << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
19
storage/zeta/cpp/completed/15552.cpp
Normal file
19
storage/zeta/cpp/completed/15552.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
|
||||
ios_base::sync_with_stdio(0);
|
||||
cin.tie(nullptr);
|
||||
int T;
|
||||
int A, B;
|
||||
std::cin >> T;
|
||||
|
||||
for (int i = 0; i < T; i++) {
|
||||
std::cin >> A >> B;
|
||||
std::cout << A + B << '\n';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
14
storage/zeta/cpp/completed/15894.cpp
Normal file
14
storage/zeta/cpp/completed/15894.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
long long solve(long long n) {
|
||||
return 4 * n;
|
||||
}
|
||||
|
||||
int main() {
|
||||
long long n;
|
||||
cin >> n;
|
||||
cout << solve(n);
|
||||
return 0;
|
||||
}
|
||||
11
storage/zeta/cpp/completed/15964.cpp
Normal file
11
storage/zeta/cpp/completed/15964.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
long long A, B;
|
||||
cin >> A >> B;
|
||||
cout << A * A - B * B;
|
||||
|
||||
return 0;
|
||||
}
|
||||
49
storage/zeta/cpp/completed/1920.cpp
Normal file
49
storage/zeta/cpp/completed/1920.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool isExist(int x, int L[], int size) { // binsearch
|
||||
int begin = 0;
|
||||
int end = size - 1;
|
||||
int mid;
|
||||
int sep;
|
||||
while (begin <= end) {
|
||||
mid = (begin + end) / 2;
|
||||
sep = L[mid];
|
||||
if (x == sep) {
|
||||
return true;
|
||||
} else if (x < sep) {
|
||||
end = mid - 1;
|
||||
} else {
|
||||
begin = mid + 1;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int N, M;
|
||||
ios::sync_with_stdio(0);
|
||||
cin.tie(NULL);
|
||||
cout.tie(NULL);
|
||||
cin >> N;
|
||||
int A[N];
|
||||
for (int i = 0; i < N; i++) {
|
||||
cin >> A[i];
|
||||
}
|
||||
sort(A, A + N);
|
||||
|
||||
cin >> M;
|
||||
int x;
|
||||
for (int i = 0; i < M; i++) {
|
||||
cin >> x;
|
||||
if (isExist(x, A, N)) {
|
||||
cout << "1\n";
|
||||
} else {
|
||||
cout << "0\n";
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
27
storage/zeta/cpp/completed/1927.cpp
Normal file
27
storage/zeta/cpp/completed/1927.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
|
||||
int main() {
|
||||
std::cin.tie(0);
|
||||
std::cout.tie(0);
|
||||
std::ios_base::sync_with_stdio(0);
|
||||
std::priority_queue<unsigned int, std::vector<unsigned int>, std::greater<int>> q;
|
||||
int N;
|
||||
std::cin >> N;
|
||||
for (int i = 0; i < N; i++) {
|
||||
int x;
|
||||
std::cin >> x;
|
||||
if (x != 0) {
|
||||
q.push(x);
|
||||
} else {
|
||||
if (q.size() != 0) {
|
||||
std::cout << q.top() << "\n";
|
||||
q.pop();
|
||||
} else {
|
||||
std::cout << 0 << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
37
storage/zeta/cpp/completed/24416.cpp
Normal file
37
storage/zeta/cpp/completed/24416.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int cnt1, cnt2, f[42];
|
||||
|
||||
int fib(int n) {
|
||||
if (n == 1 or n == 2) {
|
||||
cnt1++;
|
||||
return 1;
|
||||
} else return (fib(n - 1) + fib(n - 2));
|
||||
}
|
||||
|
||||
int fibonacci(int n) {
|
||||
return f[n];
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
int n;
|
||||
|
||||
cin >> n;
|
||||
|
||||
fib(n);
|
||||
|
||||
f[1] = 1;
|
||||
f[2] = 1;
|
||||
|
||||
for (int i = 3; i <= n; i++) {
|
||||
f[i] = f[i - 1] + f[i - 2];
|
||||
cnt2++;
|
||||
}
|
||||
cout << cnt1 << " " << cnt2 << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
29
storage/zeta/cpp/completed/2501.cpp
Normal file
29
storage/zeta/cpp/completed/2501.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int count = 1;
|
||||
int N, K;
|
||||
|
||||
cin >> N >> K;
|
||||
if(K == 1) {
|
||||
cout << 1 << endl;
|
||||
return 0;
|
||||
}
|
||||
for(int i=2;i<=N;i++) {
|
||||
if (N%i == 0) {
|
||||
count += 1;
|
||||
if (count == K) {
|
||||
cout << i << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (K > count) {
|
||||
cout << 0 << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
52
storage/zeta/cpp/completed/25206.cpp
Normal file
52
storage/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
storage/zeta/cpp/completed/2557.cpp
Normal file
6
storage/zeta/cpp/completed/2557.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include<iostream>
|
||||
|
||||
int main() {
|
||||
std::cout<<"Hello World!";
|
||||
return 0;
|
||||
}
|
||||
30
storage/zeta/cpp/completed/2563.cpp
Normal file
30
storage/zeta/cpp/completed/2563.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void add_paper(int P[], int x, int y) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int j = 0; j < 10; j++) {
|
||||
P[(x - 1 + i) * 100 + y - 1 + j] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
int Paper[100 * 100] = {0,};
|
||||
int N;
|
||||
|
||||
cin >> N;
|
||||
int _x, _y;
|
||||
for (int i = 0; i < N; i++) {
|
||||
cin >> _x >> _y;
|
||||
add_paper(Paper, _x, _y);
|
||||
}
|
||||
int A = 0;
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
A += Paper[i];
|
||||
}
|
||||
cout << A;
|
||||
return 0;
|
||||
}
|
||||
21
storage/zeta/cpp/completed/2566.cpp
Normal file
21
storage/zeta/cpp/completed/2566.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
|
||||
int main() {
|
||||
int TM = 0;
|
||||
int now;
|
||||
int idx_x, idx_y;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
std::cin >> now;
|
||||
if (now >= TM) {
|
||||
TM = now;
|
||||
idx_x = i + 1;
|
||||
idx_y = j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::cout << TM << std::endl;
|
||||
std::cout << idx_x << " " << idx_y << std::endl;
|
||||
}
|
||||
29
storage/zeta/cpp/completed/2720.cpp
Normal file
29
storage/zeta/cpp/completed/2720.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void solve(int x, int c[], int cat[]) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
c[i] = (x / cat[i]);
|
||||
x %= cat[i];
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int cat[4] = {25, 10, 5, 1};
|
||||
|
||||
int N;
|
||||
|
||||
cin >> N;
|
||||
for (int i = 0; i < N; i++) {
|
||||
int x;
|
||||
int coins[4];
|
||||
cin >> x;
|
||||
solve(x, coins, cat);
|
||||
for (int j = 0; j < 4; j++) {
|
||||
cout << coins[j] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
10
storage/zeta/cpp/completed/27323.cpp
Normal file
10
storage/zeta/cpp/completed/27323.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int A, B;
|
||||
cin >> A >> B;
|
||||
cout << A * B;
|
||||
return 0;
|
||||
}
|
||||
46
storage/zeta/cpp/completed/2738.cpp
Normal file
46
storage/zeta/cpp/completed/2738.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
auto sum(int N, int M, int A[], int B[], int S[]) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
for (int j = 0; j < M; j++) {
|
||||
S[i * M + j] = A[i * M + j] + B[i * M + j];
|
||||
}
|
||||
}
|
||||
return S;
|
||||
}
|
||||
|
||||
void display(int N, int M, int S[]) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
for (int j = 0; j < M; j++) {
|
||||
cout << S[i * M + j];
|
||||
if (j < M - 1) {
|
||||
cout << " ";
|
||||
}
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int N, M;
|
||||
cin >> N >> M;
|
||||
int A[N * M];
|
||||
int B[N * M];
|
||||
int S[N * M];
|
||||
for (int i = 0; i < N; i++) {
|
||||
for (int j = 0; j < M; j++) {
|
||||
cin >> A[i * M + j];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < N; i++) {
|
||||
for (int j = 0; j < M; j++) {
|
||||
cin >> B[i * M + j];
|
||||
}
|
||||
}
|
||||
sum(N, M, A, B, S);
|
||||
display(N, M, S);
|
||||
return 0;
|
||||
}
|
||||
19
storage/zeta/cpp/completed/2744.cpp
Normal file
19
storage/zeta/cpp/completed/2744.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
string s;
|
||||
cin >> s;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s[i];
|
||||
if (65 <= c && c <= 90) {
|
||||
s[i] += 32;
|
||||
} else {
|
||||
s[i] -= 32;
|
||||
}
|
||||
}
|
||||
cout << s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
30
storage/zeta/cpp/completed/2745.cpp
Normal file
30
storage/zeta/cpp/completed/2745.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int translate(char c) {
|
||||
if (48 <= c && c <= 57) {
|
||||
return c - 48;
|
||||
} else {
|
||||
return c - 55;
|
||||
}
|
||||
}
|
||||
|
||||
int calculate(string s, int n) {
|
||||
int l = s.length();
|
||||
int r = 0;
|
||||
for (int i = 0; i < l; i++) {
|
||||
r += translate(s[i]) * pow(n, l - i - 1);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
string s;
|
||||
int n;
|
||||
cin >> s >> n;
|
||||
cout << calculate(s, n);
|
||||
return 0;
|
||||
}
|
||||
42
storage/zeta/cpp/completed/2754.cpp
Normal file
42
storage/zeta/cpp/completed/2754.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
string s;
|
||||
cin >> s;
|
||||
float v;
|
||||
if (s == "A+") {
|
||||
v = 4.3;
|
||||
} else if (s == "A0") {
|
||||
v = 4.0;
|
||||
} else if (s == "A-") {
|
||||
v = 3.7;
|
||||
} else if (s == "B+") {
|
||||
v = 3.3;
|
||||
} else if (s == "B0") {
|
||||
v = 3.0;
|
||||
} else if (s == "B-") {
|
||||
v = 2.7;
|
||||
} else if (s == "C+") {
|
||||
v = 2.3;
|
||||
} else if (s == "C0") {
|
||||
v = 2.0;
|
||||
} else if (s == "C-") {
|
||||
v = 1.7;
|
||||
} else if (s == "D+") {
|
||||
v = 1.3;
|
||||
} else if (s == "D0") {
|
||||
v = 1.0;
|
||||
} else if (s == "D-") {
|
||||
v = 0.7;
|
||||
} else if (s == "F")
|
||||
v = 0.0;
|
||||
else {
|
||||
v = 0.0;
|
||||
}
|
||||
cout << fixed << std::setprecision(1) << v;
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
storage/zeta/cpp/completed/27866.cpp
Normal file
10
storage/zeta/cpp/completed/27866.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include<iostream>
|
||||
|
||||
int main() {
|
||||
std::string s; int N;
|
||||
std::cin >> s;
|
||||
std::cin >> N;
|
||||
std::cout << s[N-1];
|
||||
|
||||
return 0;
|
||||
}
|
||||
9
storage/zeta/cpp/completed/2903.cpp
Normal file
9
storage/zeta/cpp/completed/2903.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
|
||||
int main() {
|
||||
int n;
|
||||
std::cin >> n;
|
||||
std::cout << (int) pow(((1 << n) + 1), 2);
|
||||
return 0;
|
||||
}
|
||||
35
storage/zeta/cpp/completed/5073.cpp
Normal file
35
storage/zeta/cpp/completed/5073.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main() {
|
||||
int sides[3];
|
||||
while (true) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
cin >> sides[i];
|
||||
}
|
||||
|
||||
if (sides[0] == 0) {
|
||||
break;
|
||||
}
|
||||
sort(sides, sides + 3);
|
||||
|
||||
if (sides[0] + sides[1] <= sides[2]) {
|
||||
cout << "Invalid\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sides[0] == sides[1] and sides[1] == sides[2] and sides[2] == sides[0]) {
|
||||
cout << "Equilateral\n";
|
||||
continue;
|
||||
}
|
||||
if (sides[0] == sides[1] or sides[0] == sides[2] or sides[1] == sides[2]) {
|
||||
cout << "Isosceles\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
cout << "Scalene\n";
|
||||
}
|
||||
}
|
||||
18
storage/zeta/cpp/completed/5597.cpp
Normal file
18
storage/zeta/cpp/completed/5597.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int *arr = new int[30]{0};
|
||||
int index;
|
||||
for (int i = 0; i < 30; i++) {
|
||||
std::cin >> index;
|
||||
arr[index - 1] = 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 30; i++) {
|
||||
if (!arr[i]) {
|
||||
std::cout << i + 1 << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
20
storage/zeta/cpp/completed/9063.cpp
Normal file
20
storage/zeta/cpp/completed/9063.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int N;
|
||||
cin >> N;
|
||||
int xs[N], ys[N];
|
||||
int x, y;
|
||||
for (int i = 0; i < N; i++) {
|
||||
cin >> x >> y;
|
||||
xs[i] = x;
|
||||
ys[i] = y;
|
||||
}
|
||||
sort(xs, xs + N);
|
||||
sort(ys, ys + N);
|
||||
|
||||
cout << (xs[N - 1] - xs[0]) * (ys[N - 1] - ys[0]) << endl;
|
||||
}
|
||||
13
storage/zeta/cpp/completed/9086.cpp
Normal file
13
storage/zeta/cpp/completed/9086.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int N;
|
||||
std::string s;
|
||||
std::cin >> N;
|
||||
|
||||
for (int i = 0; i < N; i++) {
|
||||
std::cin >> s;
|
||||
std::cout << s[0] << s.back() << std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
48
storage/zeta/cpp/completed/9251.cpp
Normal file
48
storage/zeta/cpp/completed/9251.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int lenLCSeq(string s1, string s2) {
|
||||
vector<vector<int>> DP(s1.length(), vector<int>(s2.length(), 0));
|
||||
|
||||
for (int i = 0; i < s1.length(); i++) {
|
||||
for (int j = 0; j < s2.length(); j++) {
|
||||
if (s1[i] == s2[j]) {
|
||||
if (i == 0 && j == 0) {
|
||||
DP[i][j] = 1;
|
||||
} else if (i == 0 && j != 0) {
|
||||
DP[i][j] = 1;
|
||||
} else if (i != 0 && j == 0) {
|
||||
DP[i][j] = 1;
|
||||
} else {
|
||||
DP[i][j] = DP[i - 1][j - 1] + 1;
|
||||
}
|
||||
} else {
|
||||
if (i == 0 && j == 0) {
|
||||
|
||||
} else if (i == 0 && j != 0) {
|
||||
DP[i][j] = DP[i][j - 1];
|
||||
} else if (i != 0 && j == 0) {
|
||||
DP[i][j] = DP[i - 1][j];
|
||||
} else {
|
||||
DP[i][j] = max(DP[i - 1][j], DP[i][j - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return DP[s1.length() - 1][s2.length() - 1];
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
string s1, s2;
|
||||
|
||||
cin >> s1 >> s2;
|
||||
|
||||
cout << lenLCSeq(s1, s2) << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
45
storage/zeta/cpp/completed/9506.cpp
Normal file
45
storage/zeta/cpp/completed/9506.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <numeric>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
vector<int> isPerfect(int N) {
|
||||
vector<int> v;
|
||||
for (int i = 1; i < N; i++) {
|
||||
if (N % i == 0) {
|
||||
v.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
int result = accumulate(v.begin(), v.end(), 0);
|
||||
if (result == N) {
|
||||
return v;
|
||||
} else {
|
||||
return vector<int>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
int input;
|
||||
vector<int> out;
|
||||
cin >> input;
|
||||
while (input != -1) {
|
||||
|
||||
out = isPerfect(input);
|
||||
if (out.size() > 0) {
|
||||
cout << input << " = " << out[0];
|
||||
for (int i = 1; i < out.size(); i++) {
|
||||
cout << " + " << out[i];
|
||||
}
|
||||
cout << endl;
|
||||
} else {
|
||||
cout << input << " is NOT perfect." << endl;
|
||||
}
|
||||
cin >> input;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user