1065. A+B and C (64bit) (20)

要输入字符串,longlongint不够

时间限制
100 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
HOU, Qiming

Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C.

Input Specification:

The first line of the input gives the positive number of test cases, T (<=10). Then T test cases follow, each consists of a single line containing three integers A, B and C, separated by single spaces.

Output Specification:

For each test case, output in one line "Case #X: true" if A+B>C, or "Case #X: false" otherwise, where X is the case number (starting from 1).

Sample Input:
3
1 2 3
2 3 4
9223372036854775807 -9223372036854775808 0
Sample Output:
Case #1: false
Case #2: true
Case #3: false
 



   
  1. #include <iostream>
  2. #include <math.h>
  3. #include <string>
  4. #define INF 10000000
  5. using namespace std;
  6. long long int ahigh=0, alow = 0, bhigh = 0, blow = 0, chigh = 0, clow = 0;
  7. bool Cmp(void) {
  8. if (ahigh + bhigh > chigh)
  9. return true;
  10. else if (ahigh + bhigh < chigh)
  11. return false;
  12. else {
  13. if (alow + blow > clow)
  14. return true;
  15. else
  16. return false;
  17. }
  18. }
  19. int main(void) {
  20. int n;
  21. cin >> n;
  22. for (int i = 0; i < n; i++) {
  23. string a, b, c;
  24. cin >> a >> b >> c;
  25. ahigh = 0;
  26. bhigh = 0;
  27. chigh = 0;
  28. alow = 0;
  29. blow = 0;
  30. clow = 0;
  31. if (a.length() > 9) {
  32. for (int j = 0; j < a.length() - 9; j++) {
  33. ahigh *= 10;
  34. ahigh = ahigh + a[j] - '0';
  35. }
  36. for (int j = a.length() - 9; j < a.length(); j++) {
  37. alow *= 10;
  38. alow = alow + a[j] - '0';
  39. }
  40. }
  41. else {
  42. ahigh = 0;
  43. for (int j = 0; j < a.length(); j++) {
  44. alow *= 10;
  45. alow = alow + a[j] - '0';
  46. }
  47. }
  48. if (b.length() > 9) {
  49. for (int j = 0; j < b.length() - 9; j++) {
  50. bhigh *= 10;
  51. bhigh = bhigh + b[j] - '0';
  52. }
  53. for (int j = b.length() - 9; j < b.length(); j++) {
  54. blow *= 10;
  55. blow = blow + b[j] - '0';
  56. }
  57. }
  58. else {
  59. bhigh = 0;
  60. for (int j = 0; j < b.length(); j++) {
  61. blow *= 10;
  62. blow = blow + b[j] - '0';
  63. }
  64. }
  65. if (c.length() > 9) {
  66. for (int j = 0; j < c.length() - 9; j++) {
  67. chigh *= 10;
  68. chigh = chigh + c[j] - '0';
  69. }
  70. for (int j = c.length() - 9; j < c.length(); j++) {
  71. clow *= 10;
  72. clow = clow + c[j] - '0';
  73. }
  74. }
  75. else {
  76. chigh = 0;
  77. for (int j = 0; j < c.length(); j++) {
  78. clow *= 10;
  79. clow = clow + c[j] - '0';
  80. }
  81. }
  82. if (Cmp())
  83. cout << "Case #" << i + 1 << ": true"<<endl;
  84. else
  85. cout << "Case #" << i + 1 << ": false"<<endl;
  86. }
  87. return 0;
  88. }





转载于:https://www.cnblogs.com/zzandliz/p/5023206.html

Error: Problem: package policycoreutils-python-utils-2.9-19.el8.noarch requires /usr/libexec/platform-python, but none of the providers can be installed - package container-selinux-2:2.179.1-1.module+el8.6.0+785+d1251653.noarch requires policycoreutils-python-utils, but none of the providers can be installed - package platform-python-3.6.8-45.el8.rocky.0.i686 requires python3-libs(x86-32) = 3.6.8-45.el8.rocky.0, but none of the providers can be installed - package platform-python-3.6.8-45.el8.rocky.0.i686 requires libpython3.6m.so.1.0, but none of the providers can be installed - package platform-python-3.6.8-45.el8.rocky.0.x86_64 requires libpython3.6m.so.1.0()(64bit), but none of the providers can be installed - package platform-python-3.6.8-45.el8.rocky.0.x86_64 requires python3-libs(x86-64) = 3.6.8-45.el8.rocky.0, but none of the providers can be installed - package containerd.io-1.6.28-3.1.el8.x86_64 requires container-selinux >= 2:2.74, but none of the providers can be installed - installed package python3-3.7.4-8.oe1.x86_64 obsoletes python3-libs provided by python3-libs-3.6.8-45.el8.rocky.0.i686 - installed package python3-3.7.4-8.oe1.x86_64 obsoletes python3-libs provided by python3-libs-3.6.8-45.el8.rocky.0.x86_64 - conflicting requests - problem with installed package python3-3.7.4-8.oe1.x86_64 - package container-selinux-2:2.124.0-1.gitf958d0c.module+el8.5.0+681+c9a1951f.noarch is excluded - package container-selinux-2:2.130.0-1.module+el8.5.0+770+e2f49861.noarch is excluded - package container-selinux-2:2.178.0-1.module+el8.6.0+784+32aef5de.noarch is excluded - package container-selinux-2:2.178.0-2.module+el8.6.0+783+10209741.noarch is excluded (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
07-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值