CF Comparing Two Long Integers 616A
来源:互联网 发布:python logger format 编辑:程序博客网 时间:2024/06/05 00:45
字符串问题,逐个比较,分情况讨论。
#include <iostream>#include <string>#define prin(x) std::cout << x << std::endlint main(){std::ios::sync_with_stdio(false);std::string a, b, longer, shorter;std::cin >> a >> b;bool falg = true;std::string::size_type lenth_a = a.size();std::string::size_type lenth_b = b.size();if (lenth_b > lenth_a){int interval = lenth_b - lenth_a;for (std::string::size_type i = 0; i != lenth_b - lenth_a; ++i){if (b[i] > '0'){//flag = false;std::cout << "<\n";return 0;}}for (std::string::size_type i = lenth_b - lenth_a; i != lenth_b; ++i){if (a[i - interval] == b[i])continue;else if (a[i - interval] > b[i]){std::cout << ">\n";return 0;}else{std::cout << "<\n";return 0;}}std::cout << "=\n";return 0;}else if (lenth_b == lenth_a){for (std::string::size_type i = 0; i != lenth_b; ++i){if (a[i] == b[i])continue;else if (a[i] > b[i]){std::cout << ">\n";return 0;}else{std::cout << "<\n";return 0;}}std::cout << "=\n";return 0;}else{int interval = lenth_a - lenth_b;for (std::string::size_type i = 0; i != lenth_a - lenth_b; ++i){if (a[i] > '0'){//prin(a[i]);//flag = false;std::cout << ">\n";return 0;}}for (std::string::size_type i = lenth_a - lenth_b; i != lenth_a; ++i){if (a[i] == b[i - interval])continue;else if (a[i] > b[i - interval]){//prin(a[i]);//prin(b[i - interval]);std::cout << ">\n";return 0;}else{std::cout << "<\n";return 0;}}std::cout << "=\n";}return 0;}
0 0
- CF Comparing Two Long Integers 616A
- cf 616A Comparing Two Long Integers
- CodeForces 616A Comparing Two Long Integers
- CodeForces 616A Comparing Two Long Integers
- CodeForces 616A Comparing Two Long Integers
- CodeForces 616A Comparing Two Long Integers
- A. Comparing Two Long Integers
- CodeForce 616A Comparing Two Long Integers 字符串比较
- CodeForces 616 A. Comparing Two Long Integers(水~)
- CodeForces 616A Comparing Two Long Integers【字符串】
- day4 CodeForces 616A Comparing Two Long Integers
- Comparing Two Long Integers
- Educational Codeforces Round 5 A. Comparing Two Long Integers
- Codeforces--616A--Comparing Two Long Integers(模拟水题)
- CodeForces - 616A Comparing Two Long Integers (模拟)比较两个数大小
- Educational Codeforces Round 5-A. Comparing Two Long Integers(模拟)
- Educational Codeforces Round 5 A. Comparing Two Long Integers (水)
- CF Edu9 A long long
- oracle 11gr2 11.2.0.4升级11.2.0.4.2
- spring aop 5 环绕通知around
- PullToRefreshListView适配器加载不同的layout
- 黑马程序员——方法总结之网编
- oslo.config
- CF Comparing Two Long Integers 616A
- 常用的正则表达式概述
- spring aop 6 环绕通知记录应用的日志
- 算法分析—最长公共子序列(LCS)
- strip,eu-strip 及其符号表,gdb调试strip过的程序
- 测试让NSLog失效
- Oracle 11g客户端中文乱码问题
- 关于环境变量
- leveldb