码迷,mamicode.com
首页 > 其他好文 > 详细

瞎翻译啊 CodeForces 41A - Translation

时间:2014-05-23 02:27:26      阅读:587      评论:0      收藏:0      [点我收藏+]

标签:acm   c   codeforces   编程   

The translation from the Berland language into the Birland language is not an easy task. Those languages are very similar: a berlandish word differs from a birlandish word with the same meaning a little: it is spelled (and pronounced) reversely. For example, a Berlandish word code corresponds to a Birlandish word edoc. However, it‘s easy to make a mistake during the ?translation?. Vasya translated words from Berlandish into Birlandish as t. Help him: find out if he translated the word correctly.

Input

The first line contains word s, the second line contains word t. The words consist of lowercase Latin letters. The input data do not consist unnecessary spaces. The words are not empty and their lengths do not exceed 100 symbols.

Output

If the word t is a word s, written reversely, print YES, otherwise print NO.

Sample test(s)
input
code
edoc
output
YES
input
abb
aba
output
NO
input
code
code
output
NO
好久没有写codeforces的题解了,最近做的题目不怎么感觉有质量,所以就水一道好了,找找感觉!!!!!!
这题的意思就是¥#%……#&……&*(()¥&¥%(……@……&……*……&(……%*&……#(¥%¥
这题先仔细看看题目,不难发现就是要你判断第一个字符串是不是和第二个字符串倒序相同,那就好简单了,所以说啊,最近没状态,写的都是水题,然后注意下字符串的输入还有数组大小就行了!!!!!!
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
    int i,j,k;
    int t,n,m;
    int len1,len2;
    int flag;
    char liu[106],xp[106];
    while(gets(liu))
    {
        gets(xp);
        len1=strlen(liu);
        len2=strlen(xp);

        flag=0;
        if(len1!=len2)
        {
            printf("NO\n");
            continue;
        }
        for(i=0;i<len1;i++)
        {
            if(liu[i]!=xp[len1-1-i])
            {
                flag=1;
                break;
            }
        }
        if(flag==1)
            printf("NO\n");
        else
            printf("YES\n");
    }
    return 0;
}

但愿状态赶快回来,还是那句,发现了bug就指出来吧,谢谢了!

瞎翻译啊 CodeForces 41A - Translation,布布扣,bubuko.com

瞎翻译啊 CodeForces 41A - Translation

标签:acm   c   codeforces   编程   

原文地址:http://blog.csdn.net/u014231159/article/details/26577433

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!