Codeforces Round #328 (Div. 2)

Source: Internet
Author: User

This CF, ready to go back to the bedroom to take a bath, sleep, can result ...

Water a-pawnchess

The first time you forget to judge the equality of a first go to a win, hack off. Later I learned that my code was wrong (fall

for (int i=1; i<=8; ++i) {scanf ("%s", S[i]);    !!! }

Mathematics (Law-seeking) b-the Monster and the Squirrel

Test instructions: Each vertex of a polygon is referred to another point, and if it touches another ray, it stops and asks how many areas the final polygon is divided into.

Analysis: Move the following:

problem B. The Monster and the squirrel

After drawing the rays from the first vertex (n -2) triangles is formed. The subsequent rays would generate independently sub-regions in these triangles. Let's analyse the triangle determined by vertices 1, i, i + 1, after drawing the rays from vertex i and (i + 1) The triangle would be divided into (n - i) + (i-2) = n -2 regions. Therefore the total number of convex regions is (n -2)2

If The squirrel starts from the region that has 1 as a vertex, then she can go through each region of Triangle (1 , i, i + 1) once. That implies, the squirrel can collect all the walnuts in (n -2)2 jumps.

I've been guessing the conclusion and tried some formulas, but the situation with 3,4 is not right. (Stroke

Pay attention to explode int

Math c-the Big Race

Test instructions: Two in the race, each person's speed fixed, the end <=t, ask two people dead heat possible situation

Analysis: Classification discussion, if the LCM (b, W) <= T, then the points of multiples of each LCM and then followed by Min (b, W)-1 are dead heat, other cases are not analyzed in detail ...

Note that the LCM may explode long long, which can be compared with T or converted to a double log function.

/************************************************* author:running_time* Created time:2015/10/31 Saturday 22:41:05* Fi Le name:c.cpp ************************************************/#include <cstdio> #include <algorithm># Include <iostream> #include <sstream> #include <cstring> #include <cmath> #include <string > #include <vector> #include <queue> #include <deque> #include <stack> #include <list># Include <map> #include <set> #include <bitset> #include <cstdlib> #include <ctime>using namespace std; #define Lson L, Mid, RT << 1#define Rson mid + 1, R, RT << 1 | 1typedef long ll;const int N = 1e5 + 10;const int INF = 0x3f3f3f3f;const int MOD = 1e9 + 7;const Double EPS = 1e-10;c Onst Double PI = ACOs ( -1.0); ll GCD (ll A, ll b) {return B? GCD (b, a% B): A;} int main (void) {ll T, W, b;scanf ("%i64d%i64d%i64d", &t, &w, &b), if (W > B) Swap (W, b), if (W > t &amp ;& B > t) {printf ("1/1\n");} else if (B > t) {ll x = GCD (w-1, T);p rintf ("%i64d/%i64d\n", (w-1)/x, t/x);} else if (log (double) w) + log ((double) b)-Log ((double) GCD (W, b)) > Log ((Double) t)) {ll x = GCD (w-1, T);p Rin TF ("%i64d/%i64d\n", (w-1)/x, t/x);} Else{ll LCM = B/GCD (W, b) * W;IF (t% LCM = = 0) {ll y = (w-1) + (t/lcm-1) * W + 1;ll x = GCD (y, T);p rintf ("%i64d /%i64d\n ", y/x, t/x);}  Else{ll y = (w-1) + (t/lcm-1) * W + (1 + min (t LCM, w-1)), ll x = GCD (y, T);p rintf ("%i64d/%i64d\n", y/x, T/   x);}}    cout << "time Elapsed:" << 1.0 * Clock ()/clocks_per_sec << "s.\n"; return 0;}

  

Codeforces Round #328 (Div. 2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.