2016ICPC沈阳站
题号 | 题目 | 知识点 | 难度 |
---|---|---|---|
A | Thickest Burger | 贪心 | 签到 |
B | Relative atomic mass | 贪心 | 签到 |
C | Recursive sequence | 矩阵快速幂 | 快铜 |
D | Winning an Auction | ||
E | Counting Cliques | dfs+剪枝 | 稳铜快银 |
F | Similar Rotations | ||
G | Do not pour out | ||
H | Guessing the Dice Roll | ||
I | The Elder | ||
J | Query on a graph | ||
K | New Signal Decomposition | ||
L | A Random Turn Connection Game | ||
M | Subsequence |
A Thickest Burger HDU - 5948
大的数*2+小的数
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 0x3f3f3f3f
int main(){int t;cin>>t;while(t--){int a,b;cin>>a>>b;if(a>b)cout<<a*2+b<<endl;else cout<<b*2+a<<endl;}return 0;
}
B-Relative atomic mass HDU - 5949
H是1,O是16,C是12,给你一个字符串,求总值
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 0x3f3f3f3f
int main(){int t;cin>>t;while(t--){string a;cin>>a;int sum=0;for(int i=0;i<a.length();i++){if(a[i]=='H')sum++;else if(a[i]=='O')sum+=16;else if(a[i]=='C')sum+=12;}cout<<sum<<endl;}return 0;
}