aboutsummaryrefslogtreecommitdiff
path: root/works/life/chuanzhi-cup/practice-contest
diff options
context:
space:
mode:
Diffstat (limited to 'works/life/chuanzhi-cup/practice-contest')
-rw-r--r--works/life/chuanzhi-cup/practice-contest/1.cpp27
-rw-r--r--works/life/chuanzhi-cup/practice-contest/2.cpp30
-rw-r--r--works/life/chuanzhi-cup/practice-contest/3.cpp38
-rw-r--r--works/life/chuanzhi-cup/practice-contest/4.cpp47
4 files changed, 0 insertions, 142 deletions
diff --git a/works/life/chuanzhi-cup/practice-contest/1.cpp b/works/life/chuanzhi-cup/practice-contest/1.cpp
deleted file mode 100644
index 1a0d88e..0000000
--- a/works/life/chuanzhi-cup/practice-contest/1.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <iostream>
-
-int main() {
- int n;
- std::cin >> n;
-
- int count = 0;
-
- for (int i = 1; i <= n; i++) {
- int num = i;
- int sum = 0;
- while (num != 0) {
- sum += num % 10;
- num /= 10;
-
- if (sum > 9)
- break;
- }
-
- if (sum == 9)
- count++;
- }
-
- std::cout << count;
-
- return 0;
-}
diff --git a/works/life/chuanzhi-cup/practice-contest/2.cpp b/works/life/chuanzhi-cup/practice-contest/2.cpp
deleted file mode 100644
index 5622eb4..0000000
--- a/works/life/chuanzhi-cup/practice-contest/2.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <iostream>
-
-long long sqrt(long long num) {
- long long left = 1, right = num;
- while (left != right) {
- long long mid = (left + right) / 2;
- if (mid * mid < num) {
- left = mid + 1;
- } else {
- right = mid;
- }
- }
- return left;
-}
-
-int main() {
- long long c;
- std::cin >> c;
-
- for (long long i = 1; i < c; i++) {
- long long b2 = c * c - i * i;
- long long b = sqrt(b2);
- if (b * b == b2) {
- std::cout << i << " " << b;
- break;
- }
- }
-
- return 0;
-}
diff --git a/works/life/chuanzhi-cup/practice-contest/3.cpp b/works/life/chuanzhi-cup/practice-contest/3.cpp
deleted file mode 100644
index 1f79723..0000000
--- a/works/life/chuanzhi-cup/practice-contest/3.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <cmath>
-#include <iomanip>
-#include <iostream>
-#include <regex>
-#include <string>
-
-int main() {
- std::string input;
- std::getline(std::cin, input);
-
- std::regex reg(R"aaa((\d+)([GMK]?B)=\?([GMK]?B))aaa");
- std::smatch match;
- std::regex_match(input, match, reg);
-
- std::string original_number_str = match[1].str();
- std::string original_unit = match[2].str();
- std::string target_unit = match[3].str();
-
- double original_number = std::stod(original_number_str);
-
- auto to_ratio = [](const std::string s) -> double {
- if (s.size() == 1)
- return 1;
- if (s[0] == 'G')
- return std::pow(2, 30);
- if (s[0] == 'M')
- return std::pow(2, 20);
- return std::pow(2, 10);
- };
-
- double original_ratio = to_ratio(original_unit);
- double target_ratio = to_ratio(target_unit);
-
- std::cout << std::fixed << std::setprecision(6)
- << (original_number * original_ratio / target_ratio);
-
- return 0;
-}
diff --git a/works/life/chuanzhi-cup/practice-contest/4.cpp b/works/life/chuanzhi-cup/practice-contest/4.cpp
deleted file mode 100644
index bab6b2d..0000000
--- a/works/life/chuanzhi-cup/practice-contest/4.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <algorithm>
-#include <iomanip>
-#include <iostream>
-
-int score[1000001];
-double result[1000001];
-
-int main() {
- int min;
- int max;
- int sum = 0;
-
- int count;
- std::cin >> count;
-
- for (int i = 1; i <= count; i++) {
- std::cin >> score[i];
- }
-
- int n1 = score[1], n2 = score[2];
- sum += n1 + n2;
- min = std::min(n1, n2);
- max = std::max(n1, n2);
-
- for (int i = 3; i <= count; i++) {
- int current = score[i];
-
- min = std::min(current, min);
- max = std::max(current, max);
-
- sum += current;
-
- int s = sum;
- s -= min;
- s -= max;
-
- result[i] = static_cast<double>(s) / (i - 2);
- }
-
- std::cout << std::fixed << std::setprecision(2);
-
- for (int i = 3; i <= count; i++) {
- std::cout << result[i] << "\n";
- }
-
- return 0;
-}