The 11th Zhejiang Provincial Collegiate Programming Contest->Problem G:G - Ternary Calculation
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3782
题意:把输入的三元运算用计算机运算出来。
1 #include <bits/stdc++.h>
2 using namespace std;
3 int main() {
4 int t;
5 cin>>t;
6 while(t--) {
7 int a,b,c;
8 int s1=;
9 char n,m;
cin>>a>>n>>b>>m>>c;
if(n=='*'||n=='/'||n=='%') {
if(n=='*')
s1=a*b;
else if(n=='/')
s1=a/b;
else
s1=a%b;
if(m=='*')
s1=s1*c;
else if(m=='/')
s1=s1/c;
else if(m=='%')
s1=(int)s1%c;
else if(m=='+')
s1=s1+c;
else if(m=='-')
s1=s1-c;
} else if(m=='*'||m=='/'||m=='%') {
if(m=='*')
s1=b*c;
else if(m=='/')
s1=b/c;
else if(m=='%')
s1=b%c;
if(n=='+')
s1=a+s1;
else if(n=='-')
s1=a-s1;
} else {
if(n=='+')
s1=a+b;
else if(n=='-')
s1=a-b;
if(m=='+')
s1=s1+c;
else if(m=='-')
s1=s1-c;
}
printf("%d\n",s1);
}
return ;
}
The 11th Zhejiang Provincial Collegiate Programming Contest->Problem G:G - Ternary Calculation的更多相关文章
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Capture the Flag
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5503 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Team Formation
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5494 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Beauty of Array
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5496 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Lunch Time
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5499 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Convert QWERTY to Dvorak
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5502 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest May Day Holiday
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5500 The 12th Zhejiang Provincial ...
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Demacia of the Ancients
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5504 The 12th Zhejiang Provincial ...
- zjuoj The 12th Zhejiang Provincial Collegiate Programming Contest Ace of Aces
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5493 The 12th Zhejiang Provincial ...
- 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(第二部分)
Floor Function Time Limit: 10 Seconds Memory Limit: 65536 KB a, b, c and d are all positive int ...
- The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple - L Doki Doki Literature Club
Doki Doki Literature Club Time Limit: 1 Second Memory Limit: 65536 KB Doki Doki Literature Club ...
随机推荐
- .net System.Net.Mail 之用SmtpClient发送邮件 Demo
private static bool sendMail() { try { //接收人邮箱 string SendTo = "XXXXX@163.com"; //抄送人邮箱 st ...
- hive 未初始化元数据库报错
启动hive-metastore和hive-server2 用beeline连接hive报错 [root@node04 hive]# beeline Beeline version 0.13.1-cd ...
- 第八篇、微信小程序-progress组件
主要属性: 效果图: ml: <View > <!--百分比是30,并在进度条右侧显示百分比--> <Text class="text-style"& ...
- 第二篇、为UITableViewCell 高度自适应加速 缓存cell的高度
通过NSCache缓存已经算好的行高 @interface ZHCellHeightCalculator : NSObject //系统计算高度后缓存进cache -(void)setHeight:( ...
- ios开发入门篇(一):创建工程
突然心血来潮,想写点技术方面的东西,做了ios也有好几年了,就简单的写个ios开发的技术博客,希望有人能用得到. 今天就先从创建一个Hellow World工程开始 一:首先打开xcode然后单击Cr ...
- POJ 2528 Mayor’s posters
Mayor's posters Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37982 Accepted: 11030 ...
- 《RedHatLinux系统修复视频(通过本地镜像)》
此视频的测试环境: win7下安装的VMware redhatlinux6.3系统的修复 以删掉kernel系统引导故障重新安装kernel为例 基于本地镜像来对系统进行修复 如疑问可留 ...
- 《编写高质量代码-Web前端开发修改之道》笔记--第三章 高质量的HTML
本章内容: 标签的语义 为什么要使用语义化标签 如何确定你的标签是否语义良好 常见模块你真的很了解吗 标签的语义 HTML标签的设计都是有语义考虑的,部分标签的中文翻译图示及本章内容参看:3.1 标签 ...
- Spring Cloud OAuth
In this blog post we will create a secure API for external access, using OAuth 2.0, to the microserv ...
- [ Windows] [ OS ] [ Remote Desktop ] 開啟同一個帳號同時2的連線RDP的方式
感謝同事 Allen 的Support :) 執行>gpedit.msc 電腦設定>Windows元件>遠端桌面服務>遠端桌面工作階段主機>連線>限制遠端桌面服務的 ...