Contest1539 - 2019年我能变强组队训练赛第十一场

Posted accpted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Contest1539 - 2019年我能变强组队训练赛第十一场相关的知识,希望对你有一定的参考价值。

Greater New York 2012

Hailstone HOTPO

#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
int main()

    ll n;
    int T;
    cin>>T;
    while(T--)
    
        ll k;
        scanf("%lld %lld",&k,&n);
        ll maxd=0;
        ll x=n;
        maxd=x;
        while(x!=1)
        
            if(x%2==1)
            
                x=x*3+1;
            
            else
                x/=2;
            
            maxd=max(maxd,x);
        
        printf("%lld %lld\n",k,maxd);
    
    return 0;

 

Casting

#pragma GCC optimize(3, "Ofast", "inline")
 
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const int maxn = 1e7 + 10;
const int N = 28;
int p,b,k;
 
int main() 
#ifndef ONLINE_JUDGE
    freopen("1.txt", "r", stdin);
#endif
    scanf("%d",&p);
    while(p--)
        int res=0;
        scanf("%d%d",&k,&b);
        char ch;
        //getchar();
        while(ch=getchar(),ch!=‘\n‘)
            if(ch>=‘0‘&&ch<=‘9‘) 
                res = (res * b) % (b - 1);
                res = (res + ch - ‘0‘) % (b - 1);
                res %= (b - 1);
            
            //printf("***");
        
        printf("%d %d\n",k,res);
    
    return 0;

Pen Counts

#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
inline int read()

    ll res=0,f=1;
    char ch=getchar();
    while (!isdigit(ch))
    
        if (ch==‘-‘)
        
            f=-f;
        
        ch=getchar();
    
    while (isdigit(ch))
    
        res=(res<<3)+(res<<1)+ch-‘0‘;
        ch=getchar();
    
    return f*res;

int main() 
    ll _=read();
    while (_--) 
        ll n, k, b, a, ans=0;
        k=read();n=read();
        for (ll i = 1; i <= n / 3; i++) 
            b = (n - i) / 2;
            a = max(i, n / 2 - i + 1);
            ans += (b - a + 1) * 2;
            if (i == a) ans--;
            if (i != b && b == n - i - b) ans--;
        
        printf("%lld %lld\n", k, ans);
    

Faulhaber’s Triangle

import java.util.Scanner;
import java.math.BigInteger;
 
public class Main 
    public static void main(String[] args) 
        Scanner cin = new Scanner(System.in);
        BigInteger f[][][] = new BigInteger[410][410][3];
        f[0][1][0] = BigInteger.ONE;
        f[0][1][1] = BigInteger.ONE;
        for (int i = 1; i <= 400; i++) 
            BigInteger mu = BigInteger.ONE;
            for (int j = i + 1; j >= 2; j--) 
                BigInteger ii = BigInteger.valueOf(i);
                f[i][j][0] = f[i - 1][j - 1][0].multiply(ii);
                BigInteger jj = BigInteger.valueOf(j);
                f[i][j][1] = f[i - 1][j - 1][1].multiply(jj);
                if (f[i][j][1].compareTo(BigInteger.ZERO) != 0) mu = mu.multiply(f[i][j][1]);
                BigInteger d = f[i][j][0].gcd(f[i][j][1]);
                if (d.compareTo(BigInteger.ZERO) != 0) 
                    f[i][j][0] = f[i][j][0].divide(d);
                    f[i][j][1] = f[i][j][1].divide(d);
                
            
            BigInteger zi = BigInteger.ZERO;
            for (int j = 2; j <= i + 1; j++) 
                if (f[i][j][1].compareTo(BigInteger.ZERO) != 0)   zi = zi.add(mu.divide(f[i][j][1]).multiply(f[i][j][0]));
            
            BigInteger d = mu.gcd(zi);
            mu = mu.divide(d);
            zi = zi.divide(d);
            if (mu.compareTo(zi) == 0) 
                f[i][1][0] = BigInteger.ZERO;
                f[i][1][1] = BigInteger.ZERO;
             else 
                if (mu.compareTo(zi) > 0) 
                    f[i][1][0] = mu.subtract(zi);
                    f[i][1][1] = mu;
                 else 
                    f[i][1][0] = zi.subtract(mu).multiply(BigInteger.valueOf(-1));
                    f[i][1][1] = mu;
                
            
        
 
        int T = cin.nextInt();
        for (int i = 1; i <= T; i++) 
            int a = cin.nextInt(), b = cin.nextInt(), c = cin.nextInt();
            System.out.print(a + " ");
            if (f[b][c][0].compareTo(BigInteger.ZERO) == 0) 
                System.out.println("0");
             else if (f[b][c][1].compareTo(BigInteger.ONE) == 0) 
                System.out.println(f[b][c][0]);
             else System.out.println(f[b][c][0] + "/" + f[b][c][1]);
        
    

The King’s Ups and Downs

#pragma GCC optimize(3, "Ofast", "inline")
 
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const int maxn = 1e7 + 10;
const int N = 28;
ll e[28]=0,1,2,4,10,32,122,544,2770,15872,101042,707584,5405530,44736512,398721962,3807514624,38783024290,419730685952,4809759350882,58177770225664,740742376475050;
int p,d,n;
int main() 
//#ifndef ONLINE_JUDGE
//    freopen("1.txt", "r", stdin);
//#endif
    scanf("%d",&p);
    while(p--)
        scanf("%d%d",&d,&n);
        printf("%d %lld\n",d,e[n]);
    
    return 0;

  

  

以上是关于Contest1539 - 2019年我能变强组队训练赛第十一场的主要内容,如果未能解决你的问题,请参考以下文章

Contest1814 - 2019年我能变强组队训练赛第七场

Contest1828 - 2019年我能变强组队训练赛热身赛

1780 - 2019年我能变强组队训练赛第十八场

[ICPC训练联盟周赛1] CTU Open Contest 2019

快乐组队赛XD(2017 Chinese Multi-University Training, BeihangU Contest)

快乐组队赛XD(2017 Chinese Multi-University Training, BeihangU Contest)