I.Yet another A + B You are given three numbers. Is there a way to replace variables A, B and C with these numbers so the equality A + B = C is correct? Input There are three numbers X1, X2 and X3 (1 ≤ Xi ≤ 10100), each on a separate line of input. O…
G.LCS Revised The longest common subsequence is a well known DP problem: given two strings A and B, one has to compute the maximum length of a subsequence that's common to both A and B. In this particular problem we work with strings A and B formed…
E - Restore Given a matrix A of size N * N. The rows are numbered from 0 to N-1, the columns are numbered from 0 to N-1. In this matrix, the sums of each row, the sums of each column, and the sum of the two diagonals are equal. For example, a matrix…
日常训练题解 D.Triangle Formation You are given N wooden sticks. Your task is to determine how many triangles can be made from the given sticks without breaking them. Each stick can be used in at most one triangle. Input The first line of each test case co…
java大数是个好东西,用起来方便,代码短. 代码如下: import java.util.*; import java.math.*; public class Main { public static void main(String args[]) { Scanner cin = new Scanner(System.in); BigInteger a , b; while(cin.hasNext()) { a = cin.nextBigInteger(); b = cin.nextBig…
Cut the Cake Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1102 Accepted Submission(s): 540 Problem Description MMM got a big big big cake, and invited all her M friends to eat the cake tog…
java大数判断相等: 1.equals()方法2.compareTo()方法区别:2.00与2.0 equals()方法判断不等,compareTo()方法判断相等,科学的说法可以看java api文档可以通过equals()方法加striptrailingzeros()方法等效于compareTo()方法. import java.util.*; import java.math.*; public class Main { public static void main(String[]…
N! Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 73503 Accepted Submission(s): 21308 Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N! Input One N in…
import java.lang.String; import java.util.StringTokenizer; public class StringGetWord{ /* 编程提取字符串"Java is a programming language"中的各个单词,并打印输出. */ public static void main(String[] args){ String str="Java is a programming language"; Stri…
Scanner cin = new Scanner(new BufferedInputStream(System.in)); 这样定义Scanner类的对象读入数据可能会快一些! 参考这个博客继续补充内容:http://blog.csdn.net/lmyclever/article/details/6408980 1. 单元变量常用大数操作: import java.util.Scanner; import java.math.*; public class Main{ public stati…
传送门 FXTZ II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 530 Accepted Submission(s): 280 Problem Description Cirno is playing a fighting game called "FXTZ" with Sanae. Sanae is a ChuS…
赛后补题,还是要经常回顾,以前学过的匈牙利都忘记了,“猪队友”又给我讲了一遍... 怎么感觉二分图的匈牙利算法东西好多啊,啊啊啊啊啊啊啊啊啊(吐血...) 先传送一个写的很好的博客,害怕智障找不到了.大神膜%%% Orz H - Words from cubes Informikas was cleaning his drawers while he found a toy of his childhood. Well, it's not just a toy, it's a bunch…
题目链接:http://codeforces.com/contest/294/problem/C 代码: import java.util.*; import java.math.*; public class Main { public static void main(String[] args){ Scanner cin = new Scanner(System.in); BigInteger[] fir; fir = new BigInteger[1050]; fir[0] = fir[…