题目描述:
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|1
const 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为1
re = 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;
}