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. 3.cadence创建元器件

    1.打开OrCAD Capture 然后可以新建工程,也可以直接建library (打开  后 选择:OrCAD Capture CIS) 背景颜色 Options > Preferences ...

  2. boot.img的分析

    1 boot.img  boot.img是由文件头信息,内核数据以及文件系统数据组成,它们之间非页面对齐部分用0填充 文件头信息的具体结构可以在system/core/mkbootimg/bootim ...

  3. 【uva】1220 Party at Hali-Bula

    1. 题目描述公司里有$n, n \in [1, 200]$个人,他们间的关系构成树状结构.除老板外,每个员工都有唯一一个直属上司,要求从中选择尽量多的人,但是不能同时选择员工和他的直属上司,问最多能 ...

  4. 关于结构化BOM的思考

    参加了今天的"自主生产音箱类产品BOM结构问题"(即非采购而是制造的音箱)会议,我发现大家在会议上呈现的产品结构对生产计划的层级需求已上升到5层的需求了,又找段会胜要了各位前期就此 ...

  5. C#将list转换为datatable

    DataTable dt = new DataTable(); if (_list != null) { //通过反射获取list中的字段 System.Reflection.PropertyInfo ...

  6. MINA经典入门例子----Time Server

    原文地址 http://blog.sina.com.cn/s/blog_720bdf0501010b8r.html 貌似java的IO.NIO的入门例子都有相关的Time Server Demo.本例 ...

  7. 邦定lua函数到C里做为回调

    1,  int ref = luaL_ref(L, LUA_REGISTRYINDEX); //把栈顶的obj  存在lua的表里面,返回一个唯一的引用,(栈顶的obj被自动清除),,(这个引用作为回 ...

  8. hdu1052(田忌赛马 贪心)

    好坑的一道题,不过确实是贪心的一道好题,想了好久一直无法解决平局的情况.  参考了别人的思路,然后结合了自己的想法,总算是想出来了. 这题有些步骤是必须要执行的,有四个步骤 一.当期状态田忌的最慢的马 ...

  9. String.indexOf()

    int indexOf(int ch) 返回指定字符在此字符串中第一次出现处的索引. int indexOf(int ch, int fromIndex) 从指定的索引开始搜索,返回在此字符串中第一次 ...

  10. Java 炫舞按键功能 DancingPlay (整理)

    /** * Java 炫舞按键功能 DancingPlay (整理) * 2016-1-2 深圳 南山平山村 曾剑锋 * * 设计声明: * 1.本次设计是模仿QQ炫舞类游戏,当图标到红色的检测区域时 ...