Browse Source

contest 1389

webturing 4 years ago
parent
commit
d808b0636c
9 changed files with 119 additions and 0 deletions
  1. 12 0
      1389H.cpp
  2. 12 0
      1389I.cpp
  3. 14 0
      1389J.cpp
  4. 11 0
      1389K.cpp
  5. 17 0
      1389L.cpp
  6. 8 0
      1389M.cpp
  7. 14 0
      1389N.cpp
  8. 8 0
      1389O.cpp
  9. 23 0
      1389P.cpp

+ 12 - 0
1389H.cpp

@@ -0,0 +1,12 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main() {
+    int n;
+    cin >> n;
+    if(n & 1) {
+        cout << "no";
+    } else {
+        cout << "yes";
+    }
+    return 0;
+}

+ 12 - 0
1389I.cpp

@@ -0,0 +1,12 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main() {
+    int n;
+    cin >> n;
+    double s = n * 95;
+    if(s >= 300) {
+        s *= 0.85;
+    }
+    cout << fixed << setprecision(2) << s;
+    return 0;
+}

+ 14 - 0
1389J.cpp

@@ -0,0 +1,14 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main() {
+    int a, b, c;
+    cin >> a >> b >> c;
+    if(a + c <= b || a + b <= c || c + b <= a) {
+        cout << "not a triangle" << endl;
+    } else if(a * a + c * c == b * b || a * a + b * b == c * c || b * b + c * c == a * a) {
+        cout << "yes" << endl;
+    } else {
+        cout << "no" << endl;
+    }
+    return 0;
+}

+ 11 - 0
1389K.cpp

@@ -0,0 +1,11 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main() {
+    int y;
+    cin >> y;
+    if(y % 4 == 0 && y % 100 != 0 || y % 400 == 0)
+    { cout << "yes"; }
+    else
+    { cout << "no"; }
+    return 0;
+}

+ 17 - 0
1389L.cpp

@@ -0,0 +1,17 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main() {
+    int y, m, d;
+    cin >> y >> m;
+    if(m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
+        d = 31;
+    } else if(m == 4 || m == 6 || m == 9 || m == 11) {
+        d = 30;
+    } else if(y % 4 == 0 && y % 100 != 0 || y % 400 == 0) {
+        d = 29;
+    } else {
+        d = 28;
+    }
+    cout << d;
+    return 0;
+}

+ 8 - 0
1389M.cpp

@@ -0,0 +1,8 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main() {
+    int x;
+    cin >> x;
+    cout << (x > 0 ? 1 : (x < 0 ? -1 : 0)) << endl;
+    return 0;
+}

+ 14 - 0
1389N.cpp

@@ -0,0 +1,14 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main() {
+    double n;
+    cin >> n;
+    if(n < 1) {
+        cout << "y=" << fixed << setprecision(2) << n << endl;
+    } else if(n >= 1 && n < 10) {
+        cout << "y=" << fixed << setprecision(2) << 2 * n - 1 << endl;
+    } else {
+        cout << "y=" << fixed << setprecision(2) << 3 * n - 11 << endl;
+    }
+    return 0;
+}

+ 8 - 0
1389O.cpp

@@ -0,0 +1,8 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main() {
+    int a, b, c;
+    cin >> a >> b >> c;
+    cout << max(max(a, b), c);
+    return 0;
+}

+ 23 - 0
1389P.cpp

@@ -0,0 +1,23 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main() {
+    int a, b, c, d;
+    cin >> a >> b >> c >> d;
+    if(b > a) {
+        swap(a, b);
+    }
+    if(c > b) {
+        swap(b, c);
+    }
+    if(d > c) {
+        swap(d, c);
+    }
+    if(c > b) {
+        swap(c, b);
+    }
+    if(b > a) {
+        swap(a, b);
+    }
+    cout << d << " " << c << " " << b << " " << a << endl;
+    return 0;
+}