A. A+B Again?
题目大意
给定n求数位和。
思路
?
代码实现
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define Mod 998244353
#define PI acos(-1);
#define MAXN 210000
#define debug cout<<"debug:\t"
#define debugn cout<<"debug:\n"
#define enter cout<<"\n"
void fastread() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
};
void solve() {
ll n; cin >> n;
ll ans = 0;
while (n) {
ans += n % 10;
n /= 10;
}
cout << ans << "\n";
}
int main() {
//fastread();
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ll t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
B. Card Game
题目大意
Su,Sl两个人做游戏,问Su胜利的所有局内,胜利的回合数。
注意,比赛顺序不同视为不同答案。
思路
注意题意即可。
代码实现
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define Mod 998244353
#define PI acos(-1);
#define MAXN 210000
#define debug cout<<"debug:\t"
#define debugn cout<<"debug:\n"
#define enter cout<<"\n"
void fastread() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
};
void solve() {
ll a, b, c, d; cin >> a >> b >> c >> d;
ll ans = 0;
if (a > c && b > d)ans+=2;
if (a > d && b > c)ans+=2;
if (a > c && b == d)ans += 2;
if (a > d && b == c)ans += 2;
if (a == c && b > d)ans += 2;
if (a == d && b > c)ans += 2;
cout << ans << "\n";
}
int main() {
//fastread();
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ll t = 1;
cin >&