2019年湘潭大学程序设计竞赛

A,B相对比较简单,就直接贴代码了.

A-Who's better?

#include <bits/stdc++.h>
using namespace std;
int n[2],p[2],s[2];
int ck(){
    if(n[0]==n[1]){
        if(p[0]==p[1]){
            if(s[0]==s[1]) return -1; 
            return s[0]<s[1];
            
        }
        return p[0]<p[1];
    }
    return n[0]>n[1];
}
int main(){
    cin>>n[0]>>p[0]>>s[0];
    cin>>n[1]>>p[1]>>s[1];
    int tmp=ck();
    if(tmp==-1) puts("God");
    else if(tmp==1) puts("1"); 
    else puts("2");
    return 0;
}

B-Number

#include <bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int ans=0;
        while(n>1){
            ans++;
            if(n%10==0) n/=10;
            else n+=1;
        }
        cout<<ans<<endl;
    }
    return 0;
}

C-Math Problem
已知\(a\), \(a^3\) 除以 192的余数是1。求区间[L,R]之间满足条件的a的累加和是多少?
题解:

猜你喜欢

转载自www.cnblogs.com/-yjun/p/10810259.html
今日推荐