POJ 2572
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std; int main()
{
//freopen("acm.acm","r",stdin);
string s;
int pos;
int pos1;
string s1;
string s2;
string s3;
int i;
int sum1;
int sum2;
int sum3;
while(cin>>s)
{
sum1 = ;
sum2 = ;
sum3 = ;
pos = s.find('+');
s1.assign(s.begin(),s.begin()+pos);
for(i = s1.length()-; i >= ; -- i)
{
sum1 = sum1* + s1[i]-'';
}
pos1 = s.find('=');
s2.assign(s.begin()+pos+,s.begin()+pos1);
for(i = s2.length()-; i >= ; -- i)
{
sum2 = sum2* + s2[i]-'';
}
s3.assign(s.begin()+pos1+,s.end());
for(i = s3.length()-; i >= ; -- i)
{
sum3 = sum3* + s3[i]-'';
}
if(sum3 == sum1 + sum2)
cout<<"True"<<endl;
else
cout<<"False"<<endl;
}
}
POJ 2572的更多相关文章
- poj 2572 Hard to Believe, but True!
Hard to Believe, but True! Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3537 Accep ...
- 【POJ 2572 Advertisement】
Time Limit: 1000MSMemory Limit: 10000K Total Submissions: 947Accepted: 345Special Judge Description ...
- poj和hdu部分基础算法分类及难度排序
最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
随机推荐
- 2018.10.26 洛谷P4551 最长异或路径(01trie)
传送门 直接把每个点到根节点的异或距离插入01trie. 然后枚举每个点在01trie上匹配来更新答案就行了. 代码: #include<iostream> #include<cst ...
- python计算机硬件基础以及变量常量常量池,解释器编译器比较,python的两种运行方式
1.什么是编程语言 语言是一个事物与另外一个事物沟通的介质 编程语言是程序员与计算机沟通的介质 2.什么是编程 编程就是程序按照某种编程语言的语法规范将自己想要让计算机做的事情表达出来 表达的结果就是 ...
- Ng第三课:线性代数回顾(Linear Algebra Review)
3.1 矩阵和向量 3.2 加法和标量乘法 3.3 矩阵向量乘法 3.4 矩阵乘法 3.5 矩阵乘法的性质 3.6 逆.转置 3.1 矩阵和向量 如图:这个是 4×2 矩阵,即 4 行 ...
- 【repost】DOM CRUD
//DOM 的 CRUD // c 创建create // 1.直接往body中动态的添加标签(可以是任意类型)document.write('helloWorld');document.write( ...
- 第十四个目标 (fzu)
http://acm.fzu.edu.cn/contest/problem.php?cid=151&sortid=8 Problem Description 目暮警官.妃英里.阿笠博士等人接连 ...
- android sqlite select count
用sqlite 查数据多次都没有成功,原来是sql语句不对. 正确的示例如下: select count(*) as mycount from kehu
- 关于QT应用在XP系统上兼容运行的问题
修改兼容XP: 1. 项目属性->配置属性->平台工具集:Visual Studio 2013 - Windows XP (v120_xp) 2. C/C++ 属性-> 代码生成-& ...
- 状态 ajax
//html部分 <a href="#" data-status="{$vo.state}" data-urid="{$vo.id}" ...
- django后台admin管理布局
在model模块里设置 class pc_info(models.Model): ip = models.CharField(max_length=64) sn = models.CharField( ...
- [mysql] mysql 查询语句收集
// 1. 筛选出当天的中奖名单 $where = " date_format(f_ctime,'%Y-%m-%d') = current_date()"; ...