UVa 11878 - Homework Checker

题目:给你一些加减法计算式,判断有几个是正确的。

分析:简单题。直接模拟即可。

说明:╮(╯▽╰)╭。

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
	int a,b,count = 0;
	char c,d,e[10];
	while (~scanf("%d%c%d%c%s",&a,&c,&b,&d,e)) {
		if (e[0] != '?') {
			int value = 0;
			for (int i = 0; e[i]; ++ i)
				value = value*10+e[i]-'0';
			if (c == '+' && a+b == value) count ++;
			if (c == '-' && a-b == value) count ++;
		}
	}
	printf("%d\n",count);
    return 0;
}
时间: 2024-11-05 06:25:22

UVa 11878 - Homework Checker的相关文章

第一轮 E

Homework Checker Time Limit:1000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Description Download as PDF Homework Checker Your younger brother has just finished his homework for the part " additions and subtractions for integers

uva 1489 - Math teacher&#39;s homework(数位dp)

题目链接:uva 1489 - Math teacher's homework 题目大意:给定n,k,以及序列m1,m2,-,mn, 要求找到一个长度为n的序列,满足0<=xi<=mi, 并且x1XORx2XOR-XORxn=k 解题思路:数位dp,在网上看了别人的代码,高大上... 假设有二进制数 k : 00001xxxx mi:0001xxxxx, 那么对于xi即可以满足任意的x1XORx2XOR-XORxi?1XORxi+1XOR-XORxn,根据这一点进行数位dp. dp[i][j]

UVa 12412 A Typical Homework(学生信息管理系统)

A Typical Homework(a.k.a Shi Xiong Bang Bang Mang) Hi, I am an undergraduate student in institute of foreign languages. As you know, C programming is a required course in our university, even if his/her major is far from computer science. I don't lik

UVa 11917 - Do Your Own Homework

题目:Soha有很多作业要写,而Sparrow会帮助他,不过每个作业要一定的时间完成, 现在给你需要交的作业和时间期限,问能否完成,在期限后5天内完成属于交晚. 分析:简单题,字符串.字符串相同的比较天数即可. 说明:╮(╯▽╰)╭. #include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include &

Brute Force --- UVA 10167: Birthday Cake

 Problem G. Birthday Cake  Problem's Link:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=13&problem=1108&mosmsg=Submission+received+with+ID+14413715 Mean: http://luckycat.kshs.kh.edu.tw/

UVA之409 - Excuses, Excuses!

 Excuses, Excuses!  Judge Ito is having a problem with people subpoenaed for jury duty giving rather lame excuses in order to avoid serving. In order to reduce the amount of time required listening to goofy excuses, Judge Ito has asked that you write

UVA (POJ 1598)Excuses, Excuses!

Excuses, Excuses! Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Description  Excuses, Excuses!  Judge Ito is having a problem with people subpoenaed for jury duty giving rather lame excuses in order to avoid ser

UVA 562 Dividing coins --01背包的变形

01背包的变形. 先算出硬币面值的总和,然后此题变成求背包容量为V=sum/2时,能装的最多的硬币,然后将剩余的面值和它相减取一个绝对值就是最小的差值. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; #define N 50007 int c[102],d

UVA 10341 Solve It

Problem F Solve It Input: standard input Output: standard output Time Limit: 1 second Memory Limit: 32 MB Solve the equation: p*e-x + q*sin(x) + r*cos(x) + s*tan(x) + t*x2 + u = 0 where 0 <= x <= 1. Input Input consists of multiple test cases and te