SYSU_1620

6 篇文章 0 订阅

省赛前最后一场练习赛

J题:

水题,左右互相打求剩余数
水题不猜题.

C题

给出n,求sigma( A(2,n) + A(3,n) +…+A(n,n))
高精度.错了很多次的缘故是没有检查最小加数(longlong)的合理性

E题

反密码…按照要求走一遍

G题

求比给出数大的 最小的 数
1.从右往左扫得到第一个可以减的数
2.从可减的数往左扫得到第一个可以加的数
3.可以加的数右边最小排列

H题

求’1’,’2’组成的可以被2^n整除的数
目测高精度除法+乘法..一堆人用Java/Python过了..
JavaBig

//java
http://lavasoft.blog.51cto.com/62575/228705

package lavasoft; 

import java.math.BigInteger; 
import java.util.Random; 

/** 
* 测试BigInteger 
* 
* @author leizhimin 2009-11-17 12:49:41 
*/ 
public class TestBigInteger { 
        public static void main(String[] args) { 
                System.out.println("-------------------构造BigInteger---------------------"); 
                //通过byte数组来创建BigInteger 
                BigInteger bi1 = new BigInteger(new byte[]{1, 1}); 
                System.out.println("bi1=" + bi1.toString()); 
                //创建带符号的BigInteger 
                BigInteger bi2 = new BigInteger(-1, new byte[]{1, 1}); 
                System.out.println("bi2=" + bi2.toString()); 
                //创建带符号的BigInteger随机数 
                BigInteger bi3 = new BigInteger(128, 20, new Random()); 
                System.out.println("bi3=" + bi3.toString()); 
                //通过10进制字符串创建带符号的BigInteger 
                BigInteger bi4 = new BigInteger("12342342342342123423423412341"); 
                System.out.println("bi4=" + bi4.toString()); 
                //通过10进制字符串创建带符号的BigInteger 
                BigInteger bi5 = new BigInteger("88888888888888888888888888888", Character.digit('a', 33)); 
                System.out.println("bi5=" + bi5.toString()); 
                System.out.println("BigInteger的常量:"); 
                System.out.println("BigInteger.ZERO=" + BigInteger.ZERO); 
                System.out.println("BigInteger.ONE=" + BigInteger.ONE); 
                System.out.println("BigInteger.TEN=" + BigInteger.TEN); 

                System.out.println("-------------------使用BigInteger---------------------"); 
                System.out.println("bi1的相反数=" + bi1.negate()); 
                System.out.println("bi1的相反数=" + bi1.negate()); 
                System.out.println("bi1+bi2=" + bi1.add(bi2)); 
                System.out.println("bi1-bi2=" + bi1.subtract(bi2)); 
                System.out.println("bi1*bi2=" + bi1.multiply(bi2)); 
                System.out.println("bi1/bi2=" + bi1.divide(bi2)); 
                System.out.println("bi1的10次方=" + bi1.pow(10)); 
                System.out.println("bi1的10次方=" + bi1.pow(1)); 
                BigInteger[] bx = bi4.divideAndRemainder(bi1); 
                System.out.println(">>>:bx[0]=" + bx[0] + ",bx[1]=" + bx[1]); 
                System.out.println("bi2的绝对值=" + bi2.abs()); 
        } 
}

D题

理解错题意:第N天前分发而不是恰好第N天分发
主要思路是从截止日开始倒着扫,而不是从最后倒着扫

sort(D,D+tot);
    for (int i = 0; i < tot; ++i) {
        for (int j = D[i].day; j >= 1; j--) {
            if (cnt[j] == 0) {
                cnt[j] = D[i].ori;
                break;
            }
        }
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值