A. Comparing Two Long Integers

题目连接:

http://www.codeforces.com/contest/616/problem/A

Description

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/printf instead 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 "=".

Sample Input

9

10

Sample Output

<

Hint

题意

给你两个带前导0的高精度数字,然后让你比大小。

题解:

模拟一下就好了,首先看数位,然后再看每一位的数字就行了

代码

#include<bits/stdc++.h>
using namespace std; string a,b;
int main()
{
cin>>a>>b;
int len1 = a.size(),len2 = b.size();
int la = 0,lb = 0;
while(a[la]=='0'&&la<len1)la++;
while(b[lb]=='0'&&lb<len2)lb++;
if(len1-la>len2-lb)return puts(">");
if(len1-la<len2-lb)return puts("<");
for(int i=la;i<len1;i++)
{
if(a[i]>b[i-la+lb])return puts(">");
if(a[i]<b[i-la+lb])return puts("<");
}
return puts("=");
}

Codeforces Educational Codeforces Round 5 A. Comparing Two Long Integers 高精度比大小,模拟的更多相关文章

  1. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  2. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...

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

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

  4. Educational Codeforces Round 5 A. Comparing Two Long Integers

    A. Comparing Two Long Integers time limit per test 2 seconds memory limit per test 256 megabytes inp ...

  5. codeforces Educational Codeforces Round 16-E(DP)

    题目链接:http://codeforces.com/contest/710/problem/E 题意:开始文本为空,可以选择话费时间x输入或删除一个字符,也可以选择复制并粘贴一串字符(即长度变为两倍 ...

  6. Codeforces Educational Codeforces Round 15 E - Analysis of Pathes in Functional Graph

    E. Analysis of Pathes in Functional Graph time limit per test 2 seconds memory limit per test 512 me ...

  7. Codeforces Educational Codeforces Round 15 D. Road to Post Office

    D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standa ...

  8. Codeforces Educational Codeforces Round 15 C. Cellular Network

    C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

  9. Codeforces Educational Codeforces Round 5 E. Sum of Remainders 数学

    E. Sum of Remainders 题目连接: http://www.codeforces.com/contest/616/problem/E Description The only line ...

随机推荐

  1. Delphi实现文件关联

    文件关联为我们带来很多的方便.Delphi自带有注册表对象TRegistry,可以通过它取得或改变注册表相关键值的内容. Function GetAssociatedExec(FileExt: Str ...

  2. LoadRunner error -27728

    错误现象1:Action.c(16): Error -27728: Step download timeout (120 seconds) has expired whendownloading no ...

  3. Selenium2Library系列 keywords 之 _SelectElementKeywords 之 select_from_list_by_value(self, locator, *values)

    def select_from_list_by_value(self, locator, *values): """Selects `*values` from list ...

  4. static_cast .xml

    pre{ line-height:1; color:#1e1e1e; background-color:#d2d2d2; font-size:16px;}.sysFunc{color:#627cf6; ...

  5. os和os.path模块

    Os和os.path模块函数 1.      Os模块 函数 描述 文件处理 Mkfifo()/mknod() 创建命名管道/创建文件系统节点 Remove()/unlink() 删除文件 Renam ...

  6. log4net--帮助程序员将日志信息输出到各种目标(控制台、文件、数据库等)的工具

    1. log4net库是Apache log4j框架在Microsoft .NET平台的实现,是一个帮助程序员将日志信息输出到各种目标(控制台.文件.数据库等)的工具. 2. Log4net的结构如下 ...

  7. Python 学习笔记(五)杂项

    1. Assert assert len(unique_characters) <= 10, 'Too many letters' #…等价于: if len(unique_characters ...

  8. 25个让人无法抗拒的HTML5网站设计实例

    原文地址:http://www.goodfav.com/html5-website-designs-8272.html HTML5在其功能方面给网络市场带来了惊人的改进. HTML5是万维网联盟,在起 ...

  9. NSRangeFromString 测试

    官网文档 Returns a range from a textual representation. Declaration SWIFT func NSRangeFromString(_ aStri ...

  10. 远控软件VNC攻击案例研究

    欢迎大家给我投票: http://2010blog.51cto.com/350944           本文出自 "李晨光原创技术博客" 博客,谢绝转载!