多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > acm_icpc網絡賽第六站:上海賽區(跪爛心已死)

acm_icpc網絡賽第六站:上海賽區(跪爛心已死)

來源:程序員人生   發布時間:2014-10-11 08:00:01 閱讀次數:3888次

最后一站了,很無奈的是還是沒出線,最終3題結束,排名380 不得不承認自己不行,總覺著自己才弄了幾個月,然后各種為自己的弱找借口,不行就是不行,沒有借口,以后要更加努力了。廢話不多說了 Fighting!

1006:

Sawtooth

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 466    Accepted Submission(s): 152


Problem Description
Think about a plane:

● One straight line can divide a plane into two regions.
● Two lines can divide a plane into at most four regions.
● Three lines can divide a plane into at most seven regions.
● And so on...

Now we have some figure constructed with two parallel rays in the same direction, joined by two straight segments. It looks like a character “M”. You are given N such “M”s. What is the maximum number of regions that these “M”s can divide a plane ?

 

Input
The first line of the input is T (1 ≤ T ≤ 100000), which stands for the number of test cases you need to solve.

Each case contains one single non-negative integer, indicating number of “M”s. (0 ≤ N ≤ 1012)
 

Output
For each test case, print a line “Case #t: ”(without quotes, t means the index of the test case) at the beginning. Then an integer that is the maximum number of regions N the “M” figures can divide.
 

Sample Input
2 1 2
 

Sample Output
Case #1: 2 Case #2: 19
遞推+大數
增加第n+1個 “M”時,交點最多有16n個,所以增加區域 16n+1個;
f(n+1)-f(n)=16*n+1;
f(1)=2;
解得
f(n)=n*(8*n-7)+1;
然后 直接上BigInteger 就行了 然后悲劇的是當時我不會java的輸入優化結果出題人故意卡java。。最后隊友敲的數組模擬過的
下面上java輸入輸出優化的代碼 很簡單~
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Hello {
	public static void main(String[] args) throws IOException{
		StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        int t,cas=1;BigInteger n,a,b,c;
        in.nextToken();
        t=(int)in.nval;
        for(int i=1;i<=t;i++){
        	in.nextToken();
        	long x=(long)in.nval;
        	n=BigInteger.valueOf(x);
        	a=new BigInteger("8");
        	b=new BigInteger("7");
        	c=new BigInteger("1");
        	BigInteger ans=a.multiply(n);
        	ans=ans.subtract(b);
        	ans=ans.multiply(n);
        	ans=ans.add(c);
        	out.println("Case #"+cas+": "+ans);cas++;
        }
        out.flush();//刷新緩沖區 (必須)
        out.close();
	}
}

1009:

Divided Land

Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 133    Accepted Submission(s): 69


Problem Description
It’s time to fight the local despots and redistribute the land. There is a rectangular piece of land granted from the government, whose length and width are both in binary form. As the mayor, you must segment the land into multiple squares of equal size for the villagers. What are required is there must be no any waste and each single segmented square land has as large area as possible. The width of the segmented square land is also binary.
 

Input
The first line of the input is T (1 ≤ T ≤ 100), which stands for the number of test cases you need to solve.

Each case contains two binary number represents the length L and the width W of given land. (0 < L, W ≤ 21000)
 

Output
For each test case, print a line “Case #t: ”(without quotes, t means the index of the test case) at the beginning. Then one number means the largest width of land that can be divided from input data. And it will be show in binary. Do not have any useless number or space.
 

Sample Input
3 10 100 100 110 10010 1100
 

Sample Output
Case #1: 10 Case #2: 10 Case #3: 110
二進制下求a,b的最大公約數 還是BigInteger 由于一開始不知道BigInteger二進制的轉換 chp用模擬敲了半天也沒搞好 后來用java 10幾行解決了
import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        String a,b;int t,cas=1;
        t=in.nextInt();
        for(int i=0;i<t;i++){
            a=in.next();
            b=in.next();
            BigInteger x=new BigInteger(a,2);
            BigInteger y=new BigInteger(b,2);
            System.out.print("Case #"+cas+": ");cas++;
            System.out.println(x.gcd(y).toString(2));
        }
        
    }
}

1012:

the Sum of Cube

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 181    Accepted Submission(s): 114


Problem Description
A range is given, the begin and the end are both integers. You should sum the cube of all the integers in the range.
 

Input
The first line of the input is T(1 <= T <= 1000), which stands for the number of test cases you need to solve.
Each case of input is a pair of integer A,B(0 < A <= B <= 10000),representing the range[A,B].
 

Output
For each test case, print a line “Case #t: ”(without quotes, t means the index of the test case) at the beginning. Then output the answer
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 午夜在线播放免费人成无 | 亚洲 中文 欧美 日韩 在线人 | 91久久夜色精品 | 精品一区二区三区亚洲 | 成人午夜视频在线播放 | 久久性生大片免费观看性 | 中文国产 | 欧美日韩国产综合在线小说 | 色吊丝在线观看国产 | 国产精品国产三级国产a | 久久精品国产精品2020 | 久久久91精品国产一区二区三区 | 在线观看免费视频片 | 亚欧美 | 国产三级小视频 | 成人久久久 | 操白嫩| 亚洲视频 欧美视频 | 一区二区三区高清在线 | 天堂最新版免费观看 | 欧美精品第1页在线播放 | 国产乱码一区二区三区四区 | 免费中国jlzzjlzz在线播放 | 国产精品欧美日韩 | 久久一 | 欧美 国产 小说 另类 | 一二三四视频在线观看免费高清 | 羞羞影院男女午夜爽爽影视 | 一级毛片国产真人永久在线 | 性欧美18~19sex高清播放 | 久久久久久久久久久观看 | 三级爱爱视频 | 日本一级黄色 | 午夜dj视频在线观看免费 | 国产在线视频第一页 | 桃乃木香奈中文字幕 | 国产又黄又免费aaaa视频 | 欧美成人综合视频 | 国产亚洲片| 精品视频一区二区三区 | 亚洲伊人久久大香线蕉在观 |