其他分享
首页 > 其他分享> > 第四届“传智杯”全国大学生IT技能大赛(初赛B组)-题解

第四届“传智杯”全国大学生IT技能大赛(初赛B组)-题解

作者:互联网

第四届“传智杯”全国大学生IT技能大赛(初赛B组)

A组原成绩

模拟,然后最后结果算出来强转为int即可。
AC代码:

import java.io.*;
import java.util.*;


/**
 * @Author DragonOne
 * @Date 2021/12/5 21:27
 * @墨水记忆 www.tothefor.com
 */
public class Main {
    public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
    public static StreamTokenizer cin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    public static PrintWriter cout = new PrintWriter(new OutputStreamWriter(System.out));
    public static Scanner sc = new Scanner(System.in);

//    cin.ordinaryChars('0', '9') ;
//    cin.wordChars('0', '9');

    public static void main(String[] args) throws Exception {

        int t= nextInt();
        int h = nextInt();
        int e = nextInt();
        System.out.println((int)(t*0.2+h*0.3+e*0.5));

        closeAll();
    }


    public static int nextInt() throws Exception {
        cin.nextToken();
        return (int) cin.nval;
    }

    public static long nextLong() throws Exception {
        cin.nextToken();
        return (long) cin.nval;
    }

    public static double nextDouble() throws Exception {
        cin.nextToken();
        return cin.nval;
    }

    public static String nextString() throws Exception {
        cin.nextToken();
        return cin.sval;
    }

    public static void closeAll() throws Exception {
        cout.close();
        in.close();
        out.close();
    }

}

B报告赋分

模拟即可。

import java.io.*;
import java.util.*;


/**
 * @Author DragonOne
 * @Date 2021/12/5 21:27
 * @墨水记忆 www.tothefor.com
 */
public class Main {
    public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
    public static StreamTokenizer cin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    public static PrintWriter cout = new PrintWriter(new OutputStreamWriter(System.out));
    public static Scanner sc = new Scanner(System.in);

//    cin.ordinaryChars('0', '9') ;
//    cin.wordChars('0', '9');

    public static void main(String[] args) throws Exception {

        int t= nextInt();
//        int h = nextInt();
//        int e = nextInt();
//        System.out.println(String.format("%.0f",t*0.2+h*0.3+e*0.5));
        while(t--!=0){
            int a = nextInt();
            int p = nextInt();
            if(p<16){
                a-=10;
            }
            if(p>20){
                a-=(p-20);
            }
            if(a<=0) a =0;
            System.out.println(a);
        }

        closeAll();
    }


    public static int nextInt() throws Exception {
        cin.nextToken();
        return (int) cin.nval;
    }

    public static long nextLong() throws Exception {
        cin.nextToken();
        return (long) cin.nval;
    }

    public static double nextDouble() throws Exception {
        cin.nextToken();
        return cin.nval;
    }

    public static String nextString() throws Exception {
        cin.nextToken();
        return cin.sval;
    }

    public static void closeAll() throws Exception {
        cout.close();
        in.close();
        out.close();
    }

}

C竞争得分

模拟。

import java.io.*;
import java.util.*;


/**
 * @Author DragonOne
 * @Date 2021/12/5 21:27
 * @墨水记忆 www.tothefor.com
 */
public class Main {
    public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
    public static StreamTokenizer cin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    public static PrintWriter cout = new PrintWriter(new OutputStreamWriter(System.out));
    public static Scanner sc = new Scanner(System.in);

//    cin.ordinaryChars('0', '9') ;
//    cin.wordChars('0', '9');

    public static void main(String[] args) throws Exception {

        int n= nextInt();
        int[] a = new int[n+10];
        int mind=2000,maxd=0;
        for(int i=1;i<=n;++i){
            a[i]=nextInt();
            mind=Math.min(a[i],mind);
            maxd=Math.max(a[i],maxd);
        }
        for(int i=1;i<=n;++i){
            a[i]=(int)(100*((double)(a[i]-mind)/(maxd-mind)));
        }
        for(int i=1;i<=n;++i){
            if(i==1) System.out.print(a[i]);
            else System.out.print(" "+a[i]);
        }
        System.out.println();
        closeAll();
    }


    public static int nextInt() throws Exception {
        cin.nextToken();
        return (int) cin.nval;
    }

    public static long nextLong() throws Exception {
        cin.nextToken();
        return (long) cin.nval;
    }

    public static double nextDouble() throws Exception {
        cin.nextToken();
        return cin.nval;
    }

    public static String nextString() throws Exception {
        cin.nextToken();
        return cin.sval;
    }

    public static void closeAll() throws Exception {
        cout.close();
        in.close();
        out.close();
    }

}

D小卡与质数2

题目

题目链接

大致题意:求有多少个y能使xy=z(本博客内容中均为异或操作),且y<x。其中z为质数(素数)。

标签:传智杯,int,题解,cin,初赛,System,static,new,public
来源: https://blog.csdn.net/qq_63593632/article/details/122038438