E. Coins ——BNUOJ 规律题
来源:互联网 发布:拾柒网络 编辑:程序博客网 时间:2024/06/07 05:42
题目描述:
https://acm.bnu.edu.cn/v3/statments/52297.pdf
根据每个题目打表总结规律
a1 a2 a3 都不为0 为一种情况
其他在代码里展示:
#include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>#include <algorithm>#include <climits>#include <cstring>#include <string>#include <set>#include <map>#include <queue>#include <stack>#include <vector>#include <list>#define rep(i,m,n) for(i=m;i<=n;i++)#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)#define mod 2009#define INF 9999999999999#define vi vector<int>#define pb push_back#define mp make_pair#define fi first#define se second#define pi acos(-1.0)#define pii pair<int,int>#define Lson L, mid, rt<<1#define Rson mid+1, R, rt<<1|1const int maxn=5e2+10;using namespace std;typedef long long ll;ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}ll my_min(ll x,ll y){ return x>y?y:x;};int main(int argc,char *argv[]){ll a1,a2,a3; while((scanf("%lld %lld %lld",&a1,&a2,&a3)!=EOF)) { ll re = 0; if(a1!=0&&a2==0&&a3==0)//一个不为0,其他两个为0 { re = a1 ; printf("%lld\n",re); continue;}if(a1==0&&a2!=0&&a3==0) { re = a2 ; printf("%lld\n",re); continue;} if(a1==0&&a2==0&&a3!=0) { re = a3; printf("%lld\n",re); continue;} if(a1!=0&&a2!=0) { re = a1*1+a2*2+a3*3;}else if(a1 == 0 && a2 != 0){if(a2==1)//a2为1re = a3*2+1;else re = a3*3+2*a2-2; }else {if(a1==1)re = a3*2+1;else re = a3*3+a1;}printf("%lld\n",re); } return 0;}
0 0
- E. Coins ——BNUOJ 规律题
- BNUOJ 52297 Coins——打表
- BNUOJ 52297 Coins(2016 ACM-ICPC四川省赛E题)
- 2016 四川省赛 E. Coins 找规律 .
- e-Coins
- BNUOJ---E. Rectangle
- BNUOJ 34985 北京邀请赛 E题 Elegant String dp & 矩阵
- Number theory——BNUOJ
- BNUOJ 4057 魔方系列——最小装箱【细节题】
- uva 10306 e-Coins
- UVa 10306. e-Coins
- UVA 10306 e-Coins
- 10306 - e-Coins
- uva 10306 e-Coins
- UVa 10306 - e-Coins
- POJ-3021-e-Coins
- UVA - 10306 e-Coins
- UVa:10306 e-Coins
- 欧拉函数
- BZOJ 2721 [Violet 5]樱花
- Swift学习记录 -- 8.字典的基本操作
- sqlserver 练习题目(存储过程:循环erp数据表,生成另一个表数据)
- assert 的学习
- E. Coins ——BNUOJ 规律题
- 冒泡排序
- stm32 堆和栈(stm32 Heap & Stack)【worldsing笔记】
- 野指针,空指针
- u-boot-1.1.6源代码---start.S
- 缺省值,默认值
- VS 运行程序问题解决
- 代码规范
- 中国早期著名音乐家