Turing equation
时间限制:1000 ms | 内存限制:65535 KB
难度:1
描述
The fight goes on, whether to store numbers starting with their most significant digit or their least significant digit. Sometimes this is also called the "Endian War". The battleground dates far back into the early days of computer science. Joe Stoy, in his (by the way excellent) book "Denotational Semantics", tells following story:
"The decision which way round the digits run is, of course, mathematically trivial. Indeed, one early British computer had numbers running from right to left (because the spot on an oscilloscope tube runs from left to right, but in serial logic the least significant digits are dealt with first). Turing used to mystify audiences at public lectures when, quite by accident, he would slip into this mode even for decimal arithmetic, and write things like 73+42=16. The next version of the machine was made more conventional simply by crossing the x-deflection wires: this, however, worried the engineers, whose waveforms were all backwards. That problem was in turn solved by providing a little window so that the engineers (who tended to be behind the computer anyway) could view the oscilloscope screen from the back.

You will play the role of the audience and judge on the truth value of Turing's equations.

输入
The input contains several test cases. Each specifies on a single line a Turing equation. A Turing equation has the form "a+b=c", where a, b, c are numbers made up of the digits 0,...,9. Each number will consist of at most 7 digits. This includes possible leading or trailing zeros. The equation "0+0=0" will finish the input and has to be processed, too. The equations will not contain any spaces.
输出
For each test case generate a line containing the word "TRUE" or the word "FALSE", if the equation is true or false, respectively, in Turing's interpretation, i.e. the numbers being read backwards.
样例输入
73+42=16
5+8=13
0001000+000200=00030
0+0=0
样例输出
TRUE
FALSE
TRUE
来源

第七届河南省程序设计大赛

题意:

如果从右往左读取,满足式子输出“TRUE”否则输出“FALSE”

代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>using namespace std;int main()
{string s;while(cin>>s){if(s=="0+0=0")break;reverse(s.begin(),s.end());///从右往左int x1=0,x2=0,x3=0;//存放不超过七位数的各个数for(int i=0; i<s.length();){while(s[i]!='='&&i<s.length()){x1=x1*10+s[i++]-'0';  ///等号之前的取出来}i++;while(s[i]!='+'&&i<s.length()){x2=x2*10+s[i++]-'0';///加号之前的取出来}i++;while(i<s.length()){x3=x3*10+s[i++]-'0';///最后的取出来}}if(x1==x2+x3) ///如果满足的话TRUEcout<<"TRUE"<<endl;elsecout<<"FALSE"<<endl;}return 0;
}

NYOJ 1253 Turing equation (第七届河南省赛)相关推荐

  1. 第七届河南省赛部分题

    10401: A.物资调度 Time Limit: 2 Sec  Memory Limit: 128 MB Submit: 106  Solved: 62 [Submit][Status][Web B ...

  2. NYOJ 1253 Turing equation【题意是关键,模拟】

    Turing equation 时间限制:1000 ms  |  内存限制:65535 KB 难度:1 描述 The fight goes on, whether to store  numbers ...

  3. 第七届河南省赛题解B.海岛争霸

    问题 B: 海岛争霸 时间限制: 1 Sec 内存限制: 128 MB 提交: 34 解决: 17 [提交][状态][讨论版] 题目描述 神秘的海洋,惊险的探险之路,打捞海底宝藏,激烈的海战,海盗劫富 ...

  4. 第七届河南省程序设计大赛~~海岛争霸(nyoj 1248)

    海岛争霸 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述 神秘的海洋,惊险的探险之路,打捞海底宝藏,激烈的海战,海盗劫富等等.加勒比海盗,你知道吧?杰克船长驾驶着自己的的 ...

  5. 世界机器人冠军王宇航_★​身边的榜样,为你喝彩:我校学子摘冠第七届河南省VEX U机器人挑战赛...

    近日,第七届河南省大学生机器人竞赛在河南开放大学顺利闭幕.我校2018级机自专业学生王宇航.李泽坤和应用物理学专业学生闫朝硕荣获"VEX U机器人挑战赛冠军"."VEX ...

  6. 第七届河南省程序设计大赛——A 海岛争霸

    第七届河南省程序设计大赛 A 海岛争霸 内存限制:64MB 时间限制:1s Special Judge: No 题目描述: 神秘的海洋,惊险的探险之路,打捞海底宝藏,激烈的海战,海盗劫富等等.加勒比海 ...

  7. nyoj1249 物资调度 (第七届河南省程序设计大赛)

    物资调度 时间限制: 1000 ms  |  内存限制: 65535 KB 难度: 2 描述 某地区发生了地震,灾区已经非常困难,灾民急需一些帐篷.衣物.食品和血浆等物资.可通往灾区的道路到处都是塌方 ...

  8. 蓝桥杯单片机第七届省赛-模拟风扇控制系统

    九层妖塔 起于垒土 ● 改编自国信长天蓝桥杯官方蓝皮书例程,按照自己的习惯进行了补充和修改 蓝桥杯单片机第七届省赛-模拟风扇控制系统 Notes1:按键按下后在某些情况下给一定的缓冲时间 Notes2 ...

  9. 蓝桥杯嵌入式STM32G431——第七届省赛真题模拟液位检测告警系统

    第七届省赛真题模拟液位检测告警系统 第七届省赛真题 主函数部分的代码功能实现(不包含各模块初始化代码) 第七届省赛真题 主函数部分的代码功能实现(不包含各模块初始化代码) #include " ...

最新文章

  1. Spring源码分析【4】-Spring扫描basePackages注解
  2. 深入浅出开源性能测试工具 Locust (使用篇 1)
  3. 网站优化之如何提升快照的更新时间?
  4. matlab 暂停命令(pause和input)
  5. 深度学习-LeCun、Bengio和Hinton的联合综述(上)
  6. 高并发之并发容器,了解多少(从入门到超神)
  7. DataTable不能通过已删除的行访问该行的信息解决方法
  8. 函数计算搭建 Serverless Web 应用(二)- 自定义域名
  9. mysql的账户之间_MySQL用户管理
  10. (转)C#开发微信门户及应用(5)--用户分组信息管理
  11. raspbian linux,如何在 Raspberry Pi 上安装 Raspbian
  12. word文档中向下的箭头是什么,怎么去掉
  13. java启动报错Port already in use: 1099
  14. 【操作篇】Excel中如何快速插入空白行,小白技巧
  15. ChinaUnix中的音乐天地
  16. 关于域名备案后的注意事项,血淋淋的教训
  17. 对random.seed()函数的理解
  18. 在docker中搭建xss漏洞靶场
  19. Criteria查询用法
  20. 分布式医疗大数据存储方案研究综述

热门文章

  1. JAVA:AudioFiction(有声小说)项目实现
  2. 行路难,行路难,多歧路,今安在?
  3. AUTO CAD 圆角如何转换为直角?
  4. 华为面向5G的室内覆盖数字化灵活容量升级
  5. matlab环境下的yalmip+cplex的安装过程
  6. idea提示未找到包,实际上包存在 问题解决
  7. 计算机专业英语词组,《计算机专业英语词组.doc
  8. WubaRN hermes调研-基于混合工程的改造方案
  9. 计算机网络模拟校园,计算机网络课程设计-模拟校园网组网实验.doc
  10. C++ Primer Plus (第六版)编程练习记录(chapter4)