Codeforces Round #437 (Div. 2, based on Memsql start[c]up 3.0-round 2)

Source: Internet
Author: User
Tags memsql


A. Between the Officestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard OUTP Ut


As may know, Memsql have American offices in both San Francisco and Seattle. Being a manager in the company, your travel a lot between the and the cities, always by plane.



You prefer flying from Seattle to San Francisco than in the other direction, because it's warmer in San Francisco. You're so busy, you don ' t remember the number of flights you have made in either direction. However, for each of the last n days you know whether your were in San Francisco office or in Seattle office. You have fly at nights, so never were at both offices on the same day. Given this information, determine if you flew more times from Seattle to San Francisco during the last n days , or not.


Input


The first line of input contains a single integer n (2?≤? n? ≤?100)-the number of days.



The second line contains a string of length n consisting of only capital 'S ' and 'F ' letters. If the i-th letter are 'S ', then you were in Seattle office on the. Otherwise were in San Francisco. The days was given in chronological order, i.e. today was the last day of this sequence.


Output


Print "YES" If you flew the more times from Seattle to San Francisco, and "NO" otherwise.



You can print each letter in any case (upper or lower).


Examplesinput

4
Fssf
Output

NO
Input

2
SF
Output

YES
Input

10
Ffffffffff
Output

NO
Input

10
Ssffsffsff
Output

YES
Note


In the first example-were initially at San Francisco, then flew-Seattle, were there for both days and returned to Sa N Francisco. You made one flight-direction, so the answer is "NO".



In the second example you just flew from Seattle to San Francisco, so the answer is "YES".



In the third example you stayed the whole period on San Francisco, so the answer is "NO".



In the fourth example if your replace 'S ' with ones, and 'F ' with zeros, you ' ll get the first few digits of πi n binary representation. Not very useful information though.



In fact, as long as the first is S, the end is F can be


#include <bits/stdc++.h>using namespacestd;intMain () {intN; CIN>>N; stringC; CIN>>C; if(c[0]=='S'&&c[n-1]=='F') cout<<"YES"; Elsecout<<"NO"; return 0;}
B. Save the problem!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output


Attention:we lost all the test cases for this problem, so instead of solving, the problem, we need you to generate test CA Ses. We ' re going to give you the answer, and you need to print a test case that produces the given answer. The original problem is in the following paragraph.



People don ' t use cash as often as they used to. Have a credit card solves some of the hassles of the cash, such as have to receive change when you can ' t form the exact AM Ount of money needed to purchase an item. Typically cashiers would give you as few coins as possible in the change, but they don ' t has to. For example, if your change is cents, a cashier could give you a 5 cent piece and a cent piece, or they could give Y ou three cent pieces, or ten 1 cent pieces, 5 cent pieces, and one cent piece. Altogether there is different ways to make of cents using only 1 cent pieces, 5 cent pieces, cent pieces, and CE NT pieces. Ways is considered different if they contain a different number of at least one type of coin. Given The denominations of the coins and an amount of change to is made, how many different ways is there to make change?



As we mentioned before, we lost all the "test cases for this" problem, so we "re actually going to give you the number of the s, and want produce a test case for which the number of ways is the given number. There could is many ways to achieve this (we guarantee there's always on least one), so can print any, as long as it m EETs the constraints described below.


Input


Input would consist of a single integer a (1?≤? A? ≤?105), the desired number of ways.


Output


In the first line print integers N and M (1?≤? N? ≤?106,?1?≤? M.≤?10), the amount of change to being made, and the number of denominations, respectively.



Then print M integers D1,? D2,?...,? DM (1?≤? Di? ≤?106), the denominations of the coins. All denominations must is distinct:for any i? ≠? J we must have Di? ≠? DJ.



If There is multiple tests, print any of them. You can print denominations in atbitrary order.


Examplesinput

18
Output

30 4
1 5 10 25
Input

3
Output

20 2
5 2
Input

314
Output

183 4
6 5 2 139


I really don't have a clue about that.



This is the solution to the idea, milk a wave


#include <bits/stdc++.h> using namespace std; int main()
{ int n;
    cin>>n; if(n==1)
    {
        cout<<1<<" "<<1<<endl;
        cout<<1; return 0;
    } int z=2*(n-1);
    cout<<z<<" "<<2<<endl;
    cout<<1<<" "<<2<<endl; return 0;
}





Codeforces Round #437 (Div. 2, based on Memsql start[c]up 3.0-round 2)


Related Article

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.