A. Comparing Two Long Integers
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal.

The input size is very large so don't use the reading of symbols one by one. Instead of that use the reading of a whole line or token.

As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use scanf/printfinstead of cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java. Don't use the function input() in Python2 instead of it use the function raw_input().

Input

The first line contains a non-negative integer a.

The second line contains a non-negative integer b.

The numbers a, b may contain leading zeroes. Each of them contains no more than 106 digits.

Output

Print the symbol "<" if a < b and the symbol ">" if a > b. If the numbers are equal print the symbol "=".

Examples
input
9
10
output
<
input
11
10
output
>
input
00012345
12345
output
=
input
0123
9
output
>
input
0123
111
output
>

字符串,去掉前面的零,比较大小,水题。

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld; int main()
{
char a[];
char b[];
cin >> a;
cin >> b;
int lena,lenb;
int i,j;
for(i = ; a[i] == ''; i++);
for(j = ; b[j] == ''; j++);
lena = strlen(a)-i;
lenb = strlen(b)-j;
if(lena == && lenb == )
{
cout << '=';
return ;
}
else if(lena > lenb)
cout << '>';
else if(lena < lenb)
cout << '<';
else
{
int count = ;
int k = strlen(a);
for(int m = i, n = j;m < k; m++, n++)
{
int p = a[m] - '';
int q = b[n] - '';
if(p == q)
{
count = ;
continue;
}
else if(p > q)
{
count = ;
cout << '>';
break;
}
else
{
count = ;
cout << '<';
break;
}
}
if(count)
{
cout << '=';
}
} return ;
}

Educational Codeforces Round 5 A. Comparing Two Long Integers的更多相关文章

  1. Codeforces Educational Codeforces Round 5 A. Comparing Two Long Integers 高精度比大小,模拟

    A. Comparing Two Long Integers 题目连接: http://www.codeforces.com/contest/616/problem/A Description You ...

  2. codeforces Educational Codeforces Round 5 A. Comparing Two Long Integers

    题目链接:http://codeforces.com/problemset/problem/616/A 题目意思:顾名思义,就是比较两个长度不超过 1e6 的字符串的大小 模拟即可.提供两个版本,数组 ...

  3. Educational Codeforces Round 5

    616A - Comparing Two Long Integers    20171121 直接暴力莽就好了...没什么好说的 #include<stdlib.h> #include&l ...

  4. [Educational Codeforces Round 16]E. Generate a String

    [Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...

  5. [Educational Codeforces Round 16]D. Two Arithmetic Progressions

    [Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...

  6. [Educational Codeforces Round 16]C. Magic Odd Square

    [Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...

  7. [Educational Codeforces Round 16]B. Optimal Point on a Line

    [Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...

  8. [Educational Codeforces Round 16]A. King Moves

    [Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...

  9. Educational Codeforces Round 6 C. Pearls in a Row

    Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...

随机推荐

  1. 《OD学hadoop》第三周0709

    一.MapReduce编程模型1. 中心思想: 分而治之2. map(映射)3. 分布式计算模型,处理海量数据4. 一个简单的MR程序需要制定map().reduce().input.output5. ...

  2. 安装hadoop

    生成yum源 cd /var/ftp/pub/cdh/5 createrepo --update . 从节点 yum clean all 配置yum库 /etc/yum.repos.d # cat / ...

  3. UVa 1593 (水题 STL) Alignment of Code

    话说STL的I/O流用的还真不多,就着这道题熟练一下. 用了两个新函数: cout << std::setw(width[j]);    这个是设置输出宽度的,但是默认是在右侧补充空格 所 ...

  4. BZOJ 1406 密码箱

    直接两层枚举就行了. 避免排序可以用set. #include<iostream> #include<cstdio> #include<cstring> #incl ...

  5. /etc/selinux/config

    /etc/selinux/configSELINUX=disabled改成了SELINUX=enforcing机器无法启动 linux无法启动怎么解决:[1]selinux配置错误 SELinux 入 ...

  6. 支持向量机之Hinge Loss 解释

    Hinge Loss 解释 SVM 求解使通过建立二次规划原始问题,引入拉格朗日乘子法,然后转换成对偶的形式去求解,这是一种理论非常充实的解法.这里换一种角度来思考,在机器学习领域,一般的做法是经验风 ...

  7. css3 :nth-child 常用用法

    前端的哥们想必都接触过css中一个神奇的玩意,可以轻松选取你想要的标签并给与修改添加样式,是不是很给力,它就是“:nth-child”. 下面我将用几个典型的实例来给大家讲解:nth-child的实际 ...

  8. aspose.word 在书签处插入符号

    doc.Range.Bookmarks["CBJYQQDFS110"].Text = ""; Aspose.Words.DocumentBuilder buil ...

  9. 1、c#中可以有静态构造方法,而java中没有,例如在单例模式中c#可以直接在静态构造中实例化对象,而java不可以

    1.c#中可以有静态构造方法,而java中没有,例如在单例模式中c#可以直接在静态构造中实例化对象,而java不可以

  10. tcpdump命令

    tcpdump 抓包 http://blog.sina.com.cn/s/blog_6335d36b0101mrfz.html