A
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
   vector<int> a(4);
    for(int i=1;i<=3;i++){
        cin>>a[i];
    }
    sort(a.begin()+1,a.end());
    int ans=max(a[3],a[1]+a[2]);
    //排序后最大值在最后面,自己试着写一下就可以了
     cout<<ans<<endl;

}
signed main() {
    ios::sync_with_stdio(false); 
    cin.tie(0);
    int t=1;
    //cin >> t;
    while (t--) solve();
    return 0;
}
B
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
    vector<int>a(4);
   for(int i=1;i<=3;i++){
        cin>>a[i];
   }
    int ans;
    sort(a.begin()+1,a.end());
//还是先排序找最大值
    for(int i=1;i<3;i++){
        ans+=a[3]-a[i];
//每个数跟最大值的差值和
    }
    
     cout<<ans<<endl;

}
signed main() {
    ios::sync_with_stdio(false); 
    cin.tie(0);
    int t=1;
    //cin >> t;
    while (t--) solve();
    return 0;
}
C
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
    string s;
    cin>>s; 
    if(s.size()<=3){cout<<-1;return;}
    else{
//字符串跟数组一样都是从0开始,建议你们赛后自己试一下,我这个代码写得比较抽象,但是代码量很少,可以理解下
       for(int i=1;i<s.size();i++){
            if(s[i]!=s[0]){//找到跟第一个字符不同的字符
                swap(s[i],s[0]);//交换第一位跟第一个不同字符的位置
                swap(s[s.size()-1],s[s.size()-1-i]);//交换倒数第一位跟发现不同的字符的回文字符对应的位置
                 break;
            }
         cout<<-1;
           return;
       }
        
    }
    cout<<s;

}
signed main() {
    ios::sync_with_stdio(false); 
    cin.tie(0);
    int t=1;
    //cin >> t;
    while (t--) solve();
    return 0;
}
D
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
   string s;
    cin >> s;
    int len = s.size();
    string min = s; // 初始最小值设为原字符串
    
    // 枚举所有循环移位结果(i从1开始,因为i=0是原串,已初始化)
    for (int i = 1; i < len; ++i) {
        // 生成第i次循环移位的字符串:前i个字符移到末尾
        string sx = s.substr(i) + s.substr(0, i);
        // 比较并更新最小值(字符串字典序 = 数字大小)
        if (sx < min) {
            min = sx;
        }
    }
    
    cout << min << endl;
}
signed main() {
    ios::sync_with_stdio(false); 
    cin.tie(0);
    int t=1;
    cin >> t;
    while (t--) solve();
    return 0;
}
E
#include<iostream>
using namespace std;
int main(){
    int a;
    cin >> a;
    if(!a&1){//就是偶数的意思,跟a%2==0一样
        cout << a/2 << endl;
    }
    else {
        cout << (a+1)/2 <<endl;
    }
    return 0;
}
F
#include<iostream>
using namespace std;
int main(){
   int a,b,x,n;
    cin>>a>>b>>x;
    n=(x-b)/a;
     
    cout<<n;
}
G
#include <bits/stdc++.h>
using namespace std;
int main(){
    //有除法尽量用浮点
 float x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    if(y1/x1!=y2/x1)cout<<"Yes";
    else cout<<"No";//记得分清大小写,其实因为cf写习惯了,我还因为这个wa了
    return 0;
}
H
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(c>=b&&b>=a){
    if(a==b&&b==c||(b==a+1&&c==b+1))//如题不作解释
        cout<<"Yes";
    
       else
           cout<<"No";
       }
}
I
#include <bits/stdc++.h>
using namespace std;
//这个构造不会没事,还不着急,不过可以学习一下构造思想
void solve() {
    int n, k, t;
    cin >> n >> k >> t;
    // k个1最多形成k-1对相邻1,若t >= k则不可能
    if (k > 0 && t >= k) {
        cout << -1 << '\n';
        return;
    }
    
    // 没有1的情况下,t必须为0
    if (k == 0) {
        if (t == 0) {
            // 输出n个0(原fo(i, n-1, 0)等价于从0到n-1循环)
            for (int i = 0; i <= n - 1; i++) {
                cout << '0';
            }
            cout << '\n';
        } else {
            cout << -1 << '\n';
        }
        return;
    }

    // 计算需要的独立1的组数(m组1,需要m-1个0分隔)
    int m = k - t;  // 总1数 = 连续1的数量 + 独立1的数量,m为独立1的组数
    int min_len = k + (m - 1);  // 最小长度:k个1 + (m-1)个分隔0

    // 最小长度超过n,无法构造
    if (min_len > n) {
        cout << -1 << '\n';
        return;
    }

    // 输出t+1个连续1(形成t对相邻1)
    for (int i = 0; i <= t; i++) {
        cout << '1';
    }

    // 输出剩余的(m-1)组独立1(每组1个1,前面加1个0分隔)
    for (int i = 0; i <= m - 2; i++) {  // 共m-1组,已输出1组,还需m-2组
        cout << '0' << '1';
    }

    // 填充剩余的0,使总长度为n
    int len = min_len;
    for (int i = 0; i <= n - len - 1; i++) {
        cout << '0';
    }

    cout << '\n';
}

signed main() {
    ios::sync_with_stdio(false); 
    cin.tie(0);
    int t = 1;
    // cin >> t; 
    while (t--) {
        solve();
    }
    return 0;
}
J
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
     string s;
    cin>>s;
    int ans=0;
    for(char i:s){
        ans+=i-'0';//变成数字哈
    }
     cout<<ans%9<<endl;

}
signed main() {
    ios::sync_with_stdio(false); 
    cin.tie(0);
    int t=1;
    //cin >> t;
    while (t--) solve();
    return 0;
}
K
#include <bits/stdc++.h>
using namespace std;
//这题,可以直接用dp思想秒杀
void solve() {
    int ans=0;
    int a[120][120],dp[120][120];
    int n,m;
    cin>>n>>m;
    //dp数组记得清0
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j]; 
            dp[i][j]=0;
        }
    }//起点跟终点数字不一样直接没有路到达
    if(a[1][1]!=a[n][m]){
        cout<<0<<endl;
        return;
    }
    dp[1][1]=1;
     for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
           if(a[i][j]==a[n][m]){
           dp[i][j]+=dp[i-1][j]+dp[i][j-1]; 
               //从左边跟上方转移到当前位置
           }
            else dp[i][j]=0;
        }
    }
    cout<<dp[n][m]<<endl;
    
}

signed main() {
    ios::sync_with_stdio(false); 
    cin.tie(0);
    int t = 1;
    cin >> t; 
    while (t--) {
        solve();
    }
    return 0;
}


L
#include <iostream>
using namespace std;
int main()
{//我随便拿了个过的代码用,如果你们想要省工作量可以试试看map,或者是直接char[]这样去试着写
    char x;
    cin>>x;
    if(x=='U')
        cout<<'R';
    if(x=='R')
        cout<<'U';
    if(x=='L')
        cout<<'U';
    if(x=='D')
        cout<<'L';
}