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 ...
随机推荐
- springboot同时使用thymeleaf和jsp模板
语言:javaEE 框架:springboot+thymeleaf.jsp模板引擎 背景:学习springboot过程中想同时使用thymeleaf和jsp访问(官方不建议) 步骤: 1) 在pom ...
- idea关于tab的设置
新手使用,一不小心tab显示在右面了,这不学习下给搞正常点. settings===>Editor=====>Editor Tabs; Palacement设置的是tab显示的部位: Ta ...
- C语言的问题,头文件:keil也许有漏洞
2018-06-15 16:52:03 ------------------------------------------------------------------------------ ...
- 为什么行内元素不能设置margin-top/margin-bottom/padding-top/padding-bottom?
HTML 里的元素分为替换元素(replaced element)和非替换元素(non-replaced element).- 替换元素是指用作为其他内容占位符的一个元素.最典型的就是img,它只是指 ...
- php 验证码 图像存在错误 无法显示 解决方法
<?php $height = 300; $width = 300; $im = imagecreatetruecolor($width, $height); $white = imagecol ...
- python 基础_列表的其他操作 4
一.查找某个元素在数组中出现的次数 ,count的运用 a = ['a','b','c','c','c','a'] print(a.count('c')) 二.把一个元素插入到另一个元素的末尾,ext ...
- Objective-C的泛型
WWDC2015的明星是Swift.在Swift语言到2.0以后会被开源,这其中包括了protocol扩展和一个新的错误处理API. 苹果的小baby已经长成,并且意料之中的获得了开发者的关注.但是在 ...
- Application-identifier entitlement does not match问题的解决
以下是一个老外的回答: This happened to me after installing a build from TestFlight and overwriting it with the ...
- Forward团队-爬虫豆瓣top250项目-团队编程项目开发环境搭建过程
本次结对编程和团队项目我都需要用python环境,所以环境的搭建是一样的.(本文部分内容引用自己博客:http://www.cnblogs.com/xingyunqi/p/7527411.html) ...
- 20169207《Linux内核原理与分析》第六周作业
这周的作业同样分为两部分,第一部分的学习MOOC第四节[扒开系统调用的三层皮],并结合实验楼的实验四深入学习.第二部分阅读学习教材「Linux内核设计与实现 (Linux Kernel Develop ...