Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lightoj;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import static java.lang.System.out;
- import java.math.BigInteger;
- import java.util.Scanner;
- import java.util.StringTokenizer;
- public class LightOJ {
- static BigInteger fn(int a,int b, int c, int d, int e, int f, int n)
- {
- BigInteger Big_a = BigInteger.valueOf(a);
- BigInteger Big_b = BigInteger.valueOf(b);
- BigInteger Big_c = BigInteger.valueOf(c);
- BigInteger Big_d = BigInteger.valueOf(d);
- BigInteger Big_e = BigInteger.valueOf(e);
- BigInteger Big_f = BigInteger.valueOf(f);
- BigInteger Big_1 = BigInteger.valueOf(n-1);
- BigInteger Big_2 = BigInteger.valueOf(n-2);
- BigInteger Big_3 = BigInteger.valueOf(n-3);
- BigInteger Big_4 = BigInteger.valueOf(n-4);
- BigInteger Big_5 = BigInteger.valueOf(n-5);
- BigInteger Big_6 = BigInteger.valueOf(n-6);
- BigInteger Big_Sum = BigInteger.valueOf(0);
- BigInteger Big_Reminder =new BigInteger("10000007");
- if (n == 0) return Big_a;
- if (n == 1) return Big_b;
- if (n == 2) return Big_c;
- if (n == 3) return Big_d;
- if (n == 4) return Big_e;
- if (n == 5) return Big_f;
- for(int i=0;i<=n;i++)
- Big_Sum = Big_Sum.add(Big_1).add(Big_2).add(Big_3).add(Big_4).add(Big_5).add(Big_6);
- return Big_Sum;
- }
- public static void main(String[] args) throws Exception{
- FastReader scan = new FastReader();
- int n,cases,a,b,c,d,e,f;;
- cases = scan.nextInt();
- for (int caseno = 1; caseno <= cases; ++caseno) {
- a = scan.nextInt();
- b = scan.nextInt();
- c = scan.nextInt();
- d = scan.nextInt();
- e = scan.nextInt();
- f = scan.nextInt();
- n = scan.nextInt();
- System.out.println("Case "+caseno+": "+fn(a,b,c,d,e,f,n));
- }
- //% 10000007
- // int N = 20;
- }
- private static class FastReader {
- BufferedReader br;
- StringTokenizer st;
- public FastReader() {
- br = new BufferedReader(new InputStreamReader(System.in));
- }
- String next()
- {
- while (st == null || !st.hasMoreElements()) {
- try {
- st = new StringTokenizer(br.readLine());
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- }
- return st.nextToken();
- }
- int nextInt() { return Integer.parseInt(next()); }
- long nextLong() { return Long.parseLong(next()); }
- double nextDouble(){ return Double.parseDouble(next()); }
- String nextLine()
- {
- String str = "";
- try {
- str = br.readLine();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- return str;
- }
- }
- }
Add Comment
Please, Sign In to add comment