Codeforces 743A Vladik and flights (water problem)

Source: Internet
Author: User
Tags gcd cmath

Test instructions: SB to from A to B, and then to fly, only two have a plane, if you ride the same, free, if not to receive the cost of ABS (J-I), ask you the minimum cost is how much.

Analysis: The direct consideration of a and B is not the same home, if it is, the cost is 0, if not, the cost is 1. This is the least.

The code is as follows:

#pragma COMMENT (linker, "/stack:1024000000,1024000000") #include <cstdio> #include <string> #include < cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include < queue> #include <algorithm> #include <vector> #include <map> #include <cctype> #include < cmath> #include <stack> #define Lson l,m,rt<<1#define Rson m+1,r,rt<<1|1//#include <tr1/ unordered_map> #define FREOPENR freopen ("In.txt", "R", stdin) #define FREOPENW freopen ("OUT.txt", "w", stdout) using Namespace std;//using namespace std:: tr1;typedef Long Long ll;typedef pair<int, int> p;const int INF = 0x3f3f3f3f;  Const double inf = 0x3f3f3f3f3f3f;const LL LNF = 0x3f3f3f3f3f3f;const Double PI = ACOs ( -1.0); const double EPS = 1e-8;const  int MAXN = (1<<20) + 5;const LL mod = 10000000000007;const int N = 1e6 + 5;const int dr[] = {-1, 0, 1, 0, 1, 1,-1, -1};const int dc[] = {0, 1, 0,-1, 1,-1, 1, -1};const char *heX[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "11 "," 1111 "};inline ll gcd (ll A, ll b) {return b = = 0? a:gcd (b, a%b);} int n, m;const int mon[] = {0, 31, 29, 31, 30, 31, 0, +, +,, +, +, +,, N, H, H, C, h, 31};inline int Min (int a, int b) {return a < b? A:b;} inline int Max (int a, int b) {return a > b a:b;} inline ll Min (ll A, ll b) {return a < b a:b;} inline ll Max (ll A, ll b) {return a > b a:b;} inline bool Is_in (int r, int c) {return R >= 0 && r < n && C >= 0 && C < m;}    int main () {int A, B;        while (CIN >> n >> a >> b) {string S;        Cin >> S;        --a,--b;        if (s[b] = = S[a]) printf ("0\n");    else printf ("1\n"); } return 0;}

Codeforces 743A Vladik and flights (water problem)

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.