 Big Square

Description
Farmer John's cows have entered into a competition with Farmer Bob's cows. They have drawn lines on the field so it is a square grid with N × N points (2 ≤ N ≤ 100), and each cow of the two herds has positioned herself exactly on a gridpoint. Of course, no two cows can stand in the same gridpoint. The goal of each herd is to form the largest square (not necessarily parallel to the gridlines) whose corners are formed by cows from that herd.
All the cows have been placed except for Farmer John's cow Bessie. Determine the area of the largest square that Farmer John's cows can form once Bessie is placed on the field (the largest square might not necessarily contain Bessie).
Input
Line 1: A single integer, N
Lines 2..N+1: Line i+1 describes line i of the field with N characters. The characters are: 'J' for a Farmer John cow, 'B' for a Farmer Bob cow, and '*' for an unoccupied square. There will always be at least one unoccupied gridpoint.
OutputLine 1: The area of the largest square that Farmer John's cows can form, or 0 if they cannot form any square.
Sample Input6
J*J***J***J*
B*
Sample Output
4
 其他相关推荐
 Disharmony Trees
Problem Description One day Sophia finds a very big square. There are n trees in the square. They are all so tall. Sophia is very interesting in them. She finds that trees maybe disharmony and the Disharmony Value between two trees is associated with two value called FAR and SHORT. The FAR is defined as the following:If we rank all these trees according to their X Coordinates in ascending order.The tree with smallest X Coordinate is ranked 1th.The trees with the same X Coordinates are ranked the same. For example,if there are 5 tree with X Coordinates 3,3,1,3,4. Then their ranks may be 2,2,1,2,5. The FAR of two trees with X Coordinate ranks D1 and D2 is defined as F = abs(D1D2). The SHORT is defined similar to the FAR. If we rank all these trees according to their heights in ascending order，the tree with shortest height is ranked 1th.The trees with the same heights are ranked the same. For example, if there are 5 tree with heights 4,1,9,7,4. Then their ranks may be 2,1,5,4,2. The SHORT of two trees with height ranks H1 and H2 is defined as S=min(H1,H2). Two tree’s Disharmony Value is defined as F*S. So from the definition above we can see that, if two trees’s FAR is larger , the Disharmony Value is bigger. And the Disharmony value is also associated with the shorter one of the two trees. Now give you every tree’s X Coordinate and their height , Please tell Sophia the sum of every two trees’s Disharmony value among all trees. Input There are several test cases in the input For each test case, the first line contain one integer N (2 <= N <= 100,000) N represents the number of trees. Then following N lines, each line contain two integers : X, H (0 < X,H <=1,000,000,000 ), indicating the tree is located in Coordinates X and its height is H. Output For each test case output the sum of every two trees’s Disharmony value among all trees. The answer is within signed 64bit integer. Sample Input 2 10 100 20 200 4 10 100 50 500 20 200 20 100 Sample Output 1 13
 Disharmony Trees 程序的设计
Problem Description One day Sophia finds a very big square. There are n trees in the square. They are all so tall. Sophia is very interesting in them. She finds that trees maybe disharmony and the Disharmony Value between two trees is associated with two value called FAR and SHORT. The FAR is defined as the following:If we rank all these trees according to their X Coordinates in ascending order.The tree with smallest X Coordinate is ranked 1th.The trees with the same X Coordinates are ranked the same. For example,if there are 5 tree with X Coordinates 3,3,1,3,4. Then their ranks may be 2,2,1,2,5. The FAR of two trees with X Coordinate ranks D1 and D2 is defined as F = abs(D1D2). The SHORT is defined similar to the FAR. If we rank all these trees according to their heights in ascending order，the tree with shortest height is ranked 1th.The trees with the same heights are ranked the same. For example, if there are 5 tree with heights 4,1,9,7,4. Then their ranks may be 2,1,5,4,2. The SHORT of two trees with height ranks H1 and H2 is defined as S=min(H1,H2). Two tree’s Disharmony Value is defined as F*S. So from the definition above we can see that, if two trees’s FAR is larger , the Disharmony Value is bigger. And the Disharmony value is also associated with the shorter one of the two trees. Now give you every tree’s X Coordinate and their height , Please tell Sophia the sum of every two trees’s Disharmony value among all trees. Input There are several test cases in the input For each test case, the first line contain one integer N (2 <= N <= 100,000) N represents the number of trees. Then following N lines, each line contain two integers : X, H (0 < X,H <=1,000,000,000 ), indicating the tree is located in Coordinates X and its height is H. Output For each test case output the sum of every two trees’s Disharmony value among all trees. The answer is within signed 64bit integer. Sample Input 2 10 100 20 200 4 10 100 50 500 20 200 20 100 Sample Output 1 13
 Disharmony Trees 是怎么来写
Problem Description One day Sophia finds a very big square. There are n trees in the square. They are all so tall. Sophia is very interesting in them. She finds that trees maybe disharmony and the Disharmony Value between two trees is associated with two value called FAR and SHORT. The FAR is defined as the following:If we rank all these trees according to their X Coordinates in ascending order.The tree with smallest X Coordinate is ranked 1th.The trees with the same X Coordinates are ranked the same. For example,if there are 5 tree with X Coordinates 3,3,1,3,4. Then their ranks may be 2,2,1,2,5. The FAR of two trees with X Coordinate ranks D1 and D2 is defined as F = abs(D1D2). The SHORT is defined similar to the FAR. If we rank all these trees according to their heights in ascending order，the tree with shortest height is ranked 1th.The trees with the same heights are ranked the same. For example, if there are 5 tree with heights 4,1,9,7,4. Then their ranks may be 2,1,5,4,2. The SHORT of two trees with height ranks H1 and H2 is defined as S=min(H1,H2). Two tree’s Disharmony Value is defined as F*S. So from the definition above we can see that, if two trees’s FAR is larger , the Disharmony Value is bigger. And the Disharmony value is also associated with the shorter one of the two trees. Now give you every tree’s X Coordinate and their height , Please tell Sophia the sum of every two trees’s Disharmony value among all trees. Input There are several test cases in the input For each test case, the first line contain one integer N (2 <= N <= 100,000) N represents the number of trees. Then following N lines, each line contain two integers : X, H (0 < X,H <=1,000,000,000 ), indicating the tree is located in Coordinates X and its height is H. Output For each test case output the sum of every two trees’s Disharmony value among all trees. The answer is within signed 64bit integer. Sample Input 2 10 100 20 200 4 10 100 50 500 20 200 20 100 Sample Output 1 13
 Disharmony Trees 用C语言的实现方法
Problem Description One day Sophia finds a very big square. There are n trees in the square. They are all so tall. Sophia is very interesting in them. She finds that trees maybe disharmony and the Disharmony Value between two trees is associated with two value called FAR and SHORT. The FAR is defined as the following:If we rank all these trees according to their X Coordinates in ascending order.The tree with smallest X Coordinate is ranked 1th.The trees with the same X Coordinates are ranked the same. For example,if there are 5 tree with X Coordinates 3,3,1,3,4. Then their ranks may be 2,2,1,2,5. The FAR of two trees with X Coordinate ranks D1 and D2 is defined as F = abs(D1D2). The SHORT is defined similar to the FAR. If we rank all these trees according to their heights in ascending order，the tree with shortest height is ranked 1th.The trees with the same heights are ranked the same. For example, if there are 5 tree with heights 4,1,9,7,4. Then their ranks may be 2,1,5,4,2. The SHORT of two trees with height ranks H1 and H2 is defined as S=min(H1,H2). Two tree’s Disharmony Value is defined as F*S. So from the definition above we can see that, if two trees’s FAR is larger , the Disharmony Value is bigger. And the Disharmony value is also associated with the shorter one of the two trees. Now give you every tree’s X Coordinate and their height , Please tell Sophia the sum of every two trees’s Disharmony value among all trees. Input There are several test cases in the input For each test case, the first line contain one integer N (2 <= N <= 100,000) N represents the number of trees. Then following N lines, each line contain two integers : X, H (0 < X,H <=1,000,000,000 ), indicating the tree is located in Coordinates X and its height is H. Output For each test case output the sum of every two trees’s Disharmony value among all trees. The answer is within signed 64bit integer. Sample Input 2 10 100 20 200 4 10 100 50 500 20 200 20 100 Sample Output 1 13
 big.Int切片将自己重写在append（）上
<div class="posttext" itemprop="text"> <p>I am trying to get a slice of <code>big.Ints</code> of the odd numbers between 3 and the square root of <code>i</code>.</p> <p>When I run the following code:</p> <pre><code>import ( "fmt" "math/big" ) func main() { i := big.NewInt(101) var divisorsOfPrime []*big.Int squareRoot := big.NewInt(0).Sqrt(i) for n := big.NewInt(3); n.Cmp(squareRoot) == 1; n.Add(n, big.NewInt(2)) { divisorsOfPrime = append(divisorsOfPrime, n) } fmt.Println(divisorsOfPrime) } </code></pre> <p>I get the output:</p> <pre><code>[11 11 11 11] </code></pre> <p>But I expect the output:</p> <pre><code>[3 5 7 9 11] </code></pre> <p>What can I do to fix this?</p> <p>Thanks</p> </div>
 找出big.Int的平方根
<div class="posttext" itemprop="text"> <p>I am required to use big.Ints for my project because the numbers I am working with exceed the int64 limit.</p> <p>With regular ints, you can square it using:</p> <pre><code>math.Sqrt(value) </code></pre> <p>But I can't work out how to do this, but with big.Ints.</p> <p>Any help would be appreciated greatly,</p> <p>Thanks</p> </div>
 Tiles of Tetris, NOT!
Description You’ve really messed up this time. “Go buy some square tiles” your supervisor told you. But as usual, you were either busy reading that message, answering that eemail, or updating your wall status on facebook. “Go buy some tiles” was all that you could remember. Your supervisor is now complaining that the tiles you bought were not squares and you’ll be fired if you don’t fix it! “Fix it? How am I supposed to fix it?” you say to yourself. “I’m a programmer, The only tiles I know are those of the game Tetris!” There is no way you can afford to be fired either. This is your third job in less than a month. “I have to fix it!” you keep repeating. You call the store you bought the tiles from, but they won’t take them back or even exchange. “We cannot cancel orders once the merchandise has left the store”, they tell you. You take a look at the tiles, they’re all rectangleshaped and all of the same size. You’d be losing a lot if you cut them, not that you’d be able to cut them into perfect squares in the first place. “Wait a minute!” you say to yourself. You grab a bunch of tiles, put them in some arrangement and Voila, that’s a square. But that won’t convince your boss. Tiles are supposed to be small, and what you cameup with is rather big. You take another look at your arrangement, and it hits you again. “I’m on a roll today!” you say proudly to yourself. You just figured out how to find the smallest number of tiles needed to form the smallest possible square. You rush and bring your supervisor to show him your discovery. He’s not that much impressed. You’re not making sense anyway (given all the blood rushing in your head trying to explain your algorithm.) You know that the calculation is definitely much simpler than what you’re saying, but you just can’t seem to think clearly. Finally, your supervisor shouts: “First of all, the tiles have to be laiddown in the same orientation. Second, I’m running a construction site here, not a software shop! How do you expect the workers to figure out that number! You either write me a program to do the calculation you’re describing, or you go collect your netbook, your cell, your ipod, and your blackberry, and you get out of here this minute!” Input Your program will be tested on one or more data sets. Each test set is described on a single line made of two positive numbers: (0 < W,H < 1,000,000) which are the width and height of each tile. The last line is made of two zeros. Output For each test case, write the answer on a separate line. Sample Input 2 3 1 2 0 0 Sample Output 6 2
 Seeding
It is spring time and farmers have to plant seeds in the field. Tom has a nice field, which is a rectangle with n * m squares. There are big stones in some of the squares. Tom has a seedingmachine. At the beginning, the machine lies in the top left corner of the field. After the machine finishes one square, Tom drives it into an adjacent square, and continues seeding. In order to protect the machine, Tom will not drive it into a square that contains stones. It is not allowed to drive the machine into a square that been seeded before, either. Tom wants to seed all the squares that do not contain stones. Is it possible? Input The first line of each test case contains two integers n and m that denote the size of the field. (1 < n, m < 7) The next n lines give the field, each of which contains m characters. 'S' is a square with stones, and '.' is a square without stones. Input is terminated with two 0's. This case is not to be processed. Output For each test case, print "YES" if Tom can make it, or "NO" otherwise. Sample Input 4 4 .S.. .S.. .... .... 4 4 .... ...S .... ...S 0 0 Sample Output YES NO
 Tiles of Tetris, NOT! 怎么可以实现的
Problem Description You’ve really messed up this time. “Go buy some square tiles” your supervisor told you. But as usual, you were either busy reading that message, answering that eemail, or updating your wall status on facebook. “Go buy some tiles” was all that you could remember. Your supervisor is now complaining that the tiles you bought were not squares and you’ll be fired if you don’t fix it! “Fix it? How am I supposed to fix it?” you say to yourself. “I’m a programmer, The only tiles I know are those of the game Tetris!” There is no way you can afford to be fired either. This is your third job in less than a month. “I have to fix it!” you keep repeating. You call the store you bought the tiles from, but they won’t take them back or even exchange. “We cannot cancel orders once the merchandise has left the store”, they tell you. You take a look at the tiles, they’re all rectangleshaped and all of the same size. You’d be losing a lot if you cut them, not that you’d be able to cut them into perfect squares in the first place. “Wait a minute!” you say to yourself. You grab a bunch of tiles, put them in some arrangement and Voila, that’s a square. But that won’t convince your boss. Tiles are supposed to be small, and what you cameup with is rather big. You take another look at your arrangement, and it hits you again. “I’m on a roll today!” you say proudly to yourself.You just figured out how to find the smallest number of tiles needed to form the smallest possible square. You rush and bring your supervisor to show him your discovery. He’s not that much impressed. You’re not making sense anyway (given all the blood rushing in your head trying to explain your algorithm.) You know that the calculation is definitely much simpler than what you’re saying, but you just can’t seem to think clearly. Finally, your supervisor shouts: “First of all, the tiles have to be laiddown in the same orientation. Second, I’m running a construction site here, not a software shop! How do you expect the workers to figure out that number! You either write me a program to do the calculation you’re describing, or you go collect your netbook, your cell, your ipod, and your blackberry, and you get out of here this minute!” Input Your program will be tested on one or more data sets. Each test set is described on a single line made of two positive numbers: (0 < W,H < 1, 000, 000) which are the width and height of each tile. The last line is made of two zeros. Output For each test case, write the answer on a separate line. Sample Input 2 3 1 2 0 0 Sample Output 6 2
 Grandpa's Other Estate
Description From our previous contest, we know that Kamran the Believer inherited many of his grandpa抯 belongings. Apparently, his grandpa had been a mathematician in his life with interests in puzzle solving, since he has made Kamran solve another programming problem! Grandpa had a big garden with many valuable walnut trees. He has written in his will that Kamran can inherit one piece of square shaped land of a given size in the garden, such that its sides be parallel to the x and y axes. Taking advantage of the fact that no other restrictions have been mentioned in the will, Kamran wants to choose the land in which the most number of trees lie. Kamran is too wealthy now and thus too lazy to spend time and solve another algorithmic problem. He has hired you to solve this problem for him. You are given the location of all trees in the big garden and the size of the land to choose. You are to write a program to find out where to choose the land so that the most number of trees lie in it. You may consider trees as points in the plane and the land as a square. You are to find the position of the square such that it includes as many points as possible. Note that the points on the border of the square are considered to be inside it. Input The first line of the input file contains a single integer t (1 <= t <= 10), the number of test cases, followed by the input data for each test case. The first line of each test case contains an integer n (1 <= n <= 100), the number of trees, and an integer r (1 <= r <= 1000), the length of the land's side, followed by n lines, each containing two integers x and y (0 <= x, y <= 100,000) representing the coordinates of a walnut tree. Note that all coordinates are pairwise distinct. Output There should be one line per test case containing the maximum number of trees that Kamran can own. Sample Input 1 3 1 1 2 2 1 4 3 Sample Output 2
 为什么在Java和Go之间解密JWE时出现错误
<div class="posttext" itemprop="text"> <p>I am not able to encrypt/decrypt within Java and Go using Curve P521, ECDHES, and A256GCM using the same values for curve X, Y, and D. When I try to take the encrypted value from Go and Decrypt in Java it fails or vice versa it fails with:</p> <p>Go: square/gojose: error in cryptographic primitive</p> <p>Java: AES/GCM/NoPadding decryption failed: mac check in GCM failed</p> <p>Any reason why this isn't working?</p> <p>!!!Update!!! I have also added code to parse a JWK to create my KeyPair in Go. (I used the java program and printed the keypair to json).</p> <p>What I notice is that sometimes the Java encrypted value can be parsed in Go and sometimes it can't. It is my thought that there is something in the GCM decryption that might not be working quite right in Go.</p> <pre class="langgolang prettyprintoverride"><code>package main import ( "crypto/ecdsa" "crypto/elliptic" "crypto/x509" "encoding/pem" "fmt" "log" "math/big" "os" b64 "encoding/base64" //"github.com/contiamo/jwt" gojose "gopkg.in/square/gojose.v2" //jwtgo "github.com/dgrijalva/jwtgo" ) func main() { testgojmx() } func testgojmx() { plaintext := []byte("test string") xEnc := "AVuFsno89wJ5xT2z63iznxVO8H5gsfcHmS1XJ_JbfEzIsudqjrvKGrzxJT96dmP_NY7KeMvyJEUInmqcqCWbzcQ" yEnc := "ANv5hayQ3_TwMcFqPrtwa9wNkfQuynuWhhbWOXYvGArdvibDGYRIRx3O5gAjfyumpibZFQ0K0jrjb09YP3AVbtc" dEnc := "AGPoHUdXajyyRLV0bAokQTnDzlO7Kjs1zSucSu69CGfSwpg7oXSxlfptApD5O47d1PX3y0ag5228XsPFXVzYnH0" x := new(big.Int) temp, _ := b64.URLEncoding.DecodeString(xEnc) x = x.SetBytes(temp) y := new(big.Int) temp, _ = b64.URLEncoding.DecodeString(yEnc) y = y.SetBytes(temp) d := new(big.Int) temp, _ = b64.URLEncoding.DecodeString(dEnc) d = d.SetBytes(temp) privkey := new(ecdsa.PrivateKey) privkey.PublicKey.Curve = elliptic.P521() privkey.D = d privkey.PublicKey.X = x privkey.PublicKey.Y = y //javaKey := `{"kty":"EC","d":"AGPoHUdXajyyRLV0bAokQTnDzlO7Kjs1zSucSu69CGfSwpg7oXSxlfptApD5O47d1PX3y0ag5228XsPFXVzYnH0","crv":"P521","x":"AVuFsno89wJ5xT2z63iznxVO8H5gsfcHmS1XJ_JbfEzIsudqjrvKGrzxJT96dmP_NY7KeMvyJEUInmqcqCWbzcQ","y":"ANv5hayQ3_TwMcFqPrtwa9wNkfQuynuWhhbWOXYvGArdvibDGYRIRx3O5gAjfyumpibZFQ0K0jrjb09YP3AVbtc"}` //jwkSet, err := jwk.ParseString(javaKey) //if err != nil { // panic(err) //} //key, err := jwkSet.Keys[0].Materialize() //if err != nil { // panic(err) //} //privkey := key.(*ecdsa.PrivateKey) fmt.Printf("X: %d Y: %d D: %d ", privkey.X, privkey.Y, privkey.D) encrypter, err := gojose.NewEncrypter(gojose.A256GCM, gojose.Recipient{Algorithm: gojose.ECDH_ES, Key: privkey.Public()}, nil) if err != nil { panic(err) } encrypted, err := encrypter.Encrypt(plaintext) if err != nil { panic(err) } fmt.Printf("encrypted = %v ", encrypted.Header) compact, err := encrypted.CompactSerialize() if err != nil { panic(err) } //compact = "eyJlcGsiOnsia3R5IjoiRUMiLCJjcnYiOiJQLTUyMSIsIngiOiJBRUFNS2ZGQ3p5NlY2WmdPdEFjSEh1c0VEM0syUC1aZmdrd2xLWmxtRFJaeGVLcTh4dUx0cXJDTzFycWx5Wkh5MXpfOEVmWXFNM0F6YlI3UGNhQVdCTURkIiwieSI6IkFMUWpEQjNLWWpLQ2twUUsxd0VUVmtvbXZ1ZDRkT05LeXhMeFJVcGpsQ0ZNSnl1bXFlUjJvc0d4N0w3UC1aU19vemJDTnhLaWU1RVQtdlNXUXczRmNLMDAifSwiZW5jIjoiQTI1NkdDTSIsImFsZyI6IkVDREgtRVMifQ..4pyFf4sd5muL9Ony.TOMCKHHWd20nPU8.NN6MFByRemeyNa50yJGVUQ" fmt.Printf("Compact Encrypted: %v ", compact) msg, _ := gojose.ParseEncrypted(compact) fmt.Printf("Message from Encrypted: %v ", msg.Header) decrypted, err := msg.Decrypt(privkey) fmt.Printf("Decrtyped: %s ", decrypted) } </code></pre> <pre class="langjava prettyprintoverride"><code>@SpringBootApplication public class EcdhjweApplication implements CommandLineRunner { private static Logger LOG = LoggerFactory .getLogger(EcdhjweApplication.class); static ECKey exposedJWK = generateECKeyJwk(); public static void main(String[] args) { SpringApplication.run(EcdhjweApplication.class, args); } @Override public void run(String... args) { LOG.info("EXECUTING : command line runner"); try { System.out.println("D: " + exposedJWK.toECPrivateKey().getS()); System.out.println("X: " + exposedJWK.toECPublicKey().getW().getAffineX()); System.out.println("Y: " + exposedJWK.toECPublicKey().getW().getAffineY()); } catch (JOSEException e) { e.printStackTrace(); } System.out.println("======================== Encrypting ================================"); String encryptedRequest = null; try { encryptedRequest = encryptJWE("test string", exposedJWK.toECPublicKey()); } catch (Exception e) { e.printStackTrace(); } System.out.println("Encrypted Requested::: " + encryptedRequest); //encryptedRequest = "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImVwayI6eyJrdHkiOiJFQyIsImNydiI6IlAtNTIxIiwieCI6IkFOSXluNGRoZTd1UkpLWDJzTkVGaVU1dDFEYmR4ZUE5UjRReGVRdk1IXy1GZ2VLWWhNSk9uR1k0LWRzMEtVbjQtRlJfZVhuNl9HLWpqWEdGaThYVGdwVjUiLCJ5IjoiQUxYVkpaMEZmcHhaQzd6andhbEdWWjdyNTJxZlg5VmNsRnY4eWlsQ1pqY3lJbnlYT1BEVlhoWDlPYVU4R1ppeVVmOU1mQndSaTAzOUNMajdiQ0duM1lPRCJ9fQ.._ASNMu9mjl02agPG.QPV7DKPV77hiLJ8.SBGhv8JRJTl_adfFNxgO0Q"; System.out.println("======================== Decrypting Request ================================"); String decryptedDetails = null; try { decryptedDetails = decryptJWE(encryptedRequest, exposedJWK.toECPrivateKey()); } catch (Exception e) { e.printStackTrace(); } System.out.println("Decrypted Request:::" + decryptedDetails); } //private static String encryptJWE(JSONObject payload, ECPublicKey ecPublicKey) throws Exception { private static String encryptJWE(String payload, ECPublicKey ecPublicKey) throws Exception { // Build JWE header JWEHeader header = new JWEHeader.Builder(JWEAlgorithm.ECDH_ES, EncryptionMethod.A256GCM) .build(); // Build JWE Object JWEObject jweObjectClient = new JWEObject(header, new Payload(payload)); // Set Public Key, Encrypt ECDHEncrypter encrypter = new ECDHEncrypter(ecPublicKey); encrypter.getJCAContext().setContentEncryptionProvider(BouncyCastleProviderSingleton.getInstance()); jweObjectClient.encrypt(encrypter); return jweObjectClient.serialize(); } private static String decryptJWE(String vcnRequestJWE, ECPrivateKey ecPrivateKey) throws Exception { // Parse JWE & validate headers JWEObject jweObject = EncryptedJWT.parse(vcnRequestJWE); // Set PrivateKey and Decrypt ECDHDecrypter decrypter = new ECDHDecrypter(ecPrivateKey); decrypter.getJCAContext().setContentEncryptionProvider(BouncyCastleProviderSingleton.getInstance()); jweObject.decrypt(decrypter); return jweObject.getPayload().toString(); } public static ECKey generateECKeyJwk() { try { // Generate EC key pair with P521 curve String x = "AVuFsno89wJ5xT2z63iznxVO8H5gsfcHmS1XJ_JbfEzIsudqjrvKGrzxJT96dmP_NY7KeMvyJEUInmqcqCWbzcQ"; String y = "ANv5hayQ3_TwMcFqPrtwa9wNkfQuynuWhhbWOXYvGArdvibDGYRIRx3O5gAjfyumpibZFQ0K0jrjb09YP3AVbtc"; String d = "AGPoHUdXajyyRLV0bAokQTnDzlO7Kjs1zSucSu69CGfSwpg7oXSxlfptApD5O47d1PX3y0ag5228XsPFXVzYnH0"; return new ECKey.Builder(Curve.P_521, new Base64URL(x), new Base64URL(y)) .d(new Base64URL(d)) .build(); } catch (Exception e) { e.printStackTrace(); return null; } } } </code></pre> <p>The code as shown shows demonstrates working within the language. The commented out strings are the result of a run from the other language</p> </div>
 Weather Forecast
You are the God of Wind. By moving a big cloud around, you can decide the weather: it invariably rains under the cloud, and the sun shines everywhere else. But you are a benign God: your goal is to give enough rain to every field in the countryside, and sun to markets and festivals. Small humans, in their poor vocabulary, only describe this as "weather forecast". You are in charge of a small country, called Paccimc. This country is constituted of 4 x 4 square areas, denoted by their numbers. Your cloud is of size 2 x 2, and may not cross the borders of the country. You are given the schedule of markets and festivals in each area for a period of time. On the first day of the period, it is raining in the central areas (671011), independently of the schedule. On each of the following days, you may move your cloud by 1 or 2 squares in one of the four cardinal directions (North, West, South, and East), or leave it in the same position. Diagonal moves are not allowed. All moves occur at the beginning of the day. You should not leave an area without rain for a full week (that is, you are allowed at most 6 consecutive days without rain). You don't have to care about rain on days outside the period you were given: i.e. you can assume it rains on the whole country the day before the period, and the day after it finishes. Input The input is a sequence of data sets, followed by a terminating line containing only a zero. A data set gives the number N of days (no more than 365) in the period on a single line, followed by N lines giving the schedule for markets and festivals. The ith line gives the schedule for the ith day. It is composed of 16 numbers, either 0 or 1, 0 standing for a normal day, and 1 a market or festival day. The numbers are separated by one or more spaces. Output The answer is a 0 or 1 on a single line for each data set, 1 if you can satisfy everybody, 0 if there is no way to do it. Sample Input 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 Sample Output 0 1 0 1
 Camelot
Description ![](http://poj.org/images/1178_1.jpg) Centuries ago, King Arthur and the Knights of the Round Table used to meet every year on New Year's Day to celebrate their fellowship. In remembrance of these events, we consider a board game for one player, on which one king and several knight pieces are placed at random on distinct squares. The Board is an 8x8 array of squares. The King can move to any adjacent square, as shown in Figure 2, as long as it does not fall off the board. A Knight can jump as shown in Figure 3, as long as it does not fall off the board. During the play, the player can place more than one piece in the same square. The board squares are assumed big enough so that a piece is never an obstacle for other piece to move freely. The player's goal is to move the pieces so as to gather them all in the same square, in the smallest possible number of moves. To achieve this, he must move the pieces as prescribed above. Additionally, whenever the king and one or more knights are placed in the same square, the player may choose to move the king and one of the knights together henceforth, as a single knight, up to the final gathering point. Moving the knight together with the king counts as a single move. Write a program to compute the minimum number of moves the player must perform to produce the gathering. Input Your program is to read from standard input. The input contains the initial board configuration, encoded as a character string. The string contains a sequence of up to 64 distinct board positions, being the first one the position of the king and the remaining ones those of the knights. Each position is a letterdigit pair. The letter indicates the horizontal board coordinate, the digit indicates the vertical board coordinate. 0 <= number of knights <= 63 Output Your program is to write to standard output. The output must contain a single line with an integer indicating the minimum number of moves the player must perform to produce the gathering. Sample Input D4A3A8H1H8 Sample Output 10
 jstl标签map中value读入<span>的值通过id在js中难以获取，求大神赐教！
jsp为上层for循环，key值可展示及传递，value只能展示不能传递，怎么解？ 下面为源代码： javascript函数： ``` function trsubmit() { var aa = document.getElementById("test22"); alert(aa.innerHTML); } jsp主要代码： <c:forEach var="big" items="${applicationScope.bigMap}"> <! 栏目> <div class="classBar"> <li style="liststyletype: square;color:#FFFFFF" >${big.key}</li> </div> <! 板块<String, HashMap<String, bbs_board>>> <table border="0" cellspacing=0 bordercolor="lightgrey" bordercolorlight="lightgrey" bordercolordark="white"> <c:forEach var="small" items="${big.value}"> <tr > <form action="tiezi.do" method="post" id="trform"> <span onclick="trsubmit();"** id="test22"**>${small.key}</span> </form> <td style="textalign: center;" width="100px"> <img alt="" src="img/index/boardPic.jpg" style="margintop: 40px"> </td> </tr> </c:forEach> </table> </c:forEach> ```
 Farming
Task You have a big farm, and you want to grow vegetables in it. You're too lazy to seed the seeds yourself, so you've hired n people to do the job for you. Each person works in a rectangular piece of land, seeding one seed in one unit square. The working areas of different people may overlap, so one unit square can be seeded several times. However, due to limited space, different seeds in one square fight each other  finally, the most powerful seed wins. If there are several "most powerful" seeds, one of them win (it does not matter which one wins). There are m kinds of seeds. Different seeds grow up into different vegetables and sells for different prices. As a rule, more powerful seeds always grow up into more expensive vegetables. Your task is to calculate how much money will you get, by selling all the vegetables in the whole farm. Input The first line contains a single integer T (T <= 10), the number of test cases. Each case begins with two integers n, m (1 <= n <= 30000, 1 <= m <= 3). The next line contains m distinct positive integers pi (1 <= pi <= 100), the prices of each kind of vegetable. The vegetables (and their corresponding seeds) are numbered 1 to m in the order they appear in the input. Each of the following n lines contains five integers x1, y1, x2, y2, s, indicating a working seeded a rectangular area with lowerleft corner (x1,y1), upperright corner (x2,y2), with the sth kind of seed. All of x1, y1, x2, y2 will be no larger than 106 in their absolute values. Output For each test case, print the case number and your final income. Sample Input 2 1 1 25 0 0 10 10 1 2 2 5 2 0 0 2 1 1 1 0 3 2 2 Sample Output Case 1: 2500 Case 2: 16
 在中国程序员是青春饭吗？
今年，我也32了 ，为了不给大家误导，咨询了猎头、圈内好友，以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助，记得帮我点赞哦。 目录： 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时，拿着傲人的工资，想着好好干，以为我们的人生是这样的： 等真到了那一天，你会发现，你的人生很可能是这样的： ...
 程序员请照顾好自己，周末病魔差点一套带走我。
程序员在一个周末的时间，得了重病，差点当场去世，还好及时挽救回来了。
 Java基础知识面试题（2020最新版）
文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性？原理是什么Java语言有哪些特点什么是字节码？采用字节码的最大好处是什么什么是Java程序的主类？应用程序和小程序的主类有何不同？Java应用程序与小程序之间有那些差别？Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...
 和黑客斗争的 6 天！
互联网公司工作，很难避免不和黑客们打交道，我呆过的两家互联网公司，几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口，有的是寻找线上服务器可能存在的漏洞，大部分都...
 Intellij IDEA 实用插件安利
1. 前言从2020 年 JVM 生态报告解读 可以看出Intellij IDEA 目前已经稳坐 Java IDE 头把交椅。而且统计得出付费用户已经超过了八成（国外统计）。IDEA 的...
 搜狗输入法也在挑战国人的智商！
故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件！》这篇文章之后，鲁大师的市场工作人员就找到了我，希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...
 总结了 150 余个神奇网站，你不来瞅瞅吗？
原博客再更新，可能就没了，之后将持续更新本篇博客。
 副业收入是我做程序媛的3倍，工作外的B面人生是怎样的？
提到“程序员”，多数人脑海里首先想到的大约是：为人木讷、薪水超高、工作枯燥…… 然而，当离开工作岗位，撕去层层标签，脱下“程序员”这身外套，有的人生动又有趣，马上展现出了完全不同的A/B面人生！ 不论是简单的爱好，还是正经的副业，他们都干得同样出色。偶尔，还能和程序员的特质结合，产生奇妙的“化学反应”。 @Charlotte：平日素颜示人，周末美妆博主 大家都以为程序媛也个个不修边幅，但我们也许...
 MySQL数据库面试题（2020最新版）
文章目录数据库基础知识为什么要使用数据库什么是SQL？什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式？分别有什么区别？数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别？InnoDB引擎的4大特性存储引擎选择索引什么是索引？索引有哪些优缺点？索引使用场景（重点）...
 如果你是老板，你会不会踢了这样的员工？
有个好朋友ZS，是技术总监，昨天问我：“有一个老下属，跟了我很多年，做事勤勤恳恳，主动性也很好。但随着公司的发展，他的进步速度，跟不上团队的步伐了，有点...
 我入职阿里后，才知道原来简历这么写
私下里，有不少读者问我：“二哥，如何才能写出一份专业的技术简历呢？我总感觉自己写的简历太烂了，所以投了无数份，都石沉大海了。”说实话，我自己好多年没有写过简历了，但我认识的一个同行，他在阿里，给我说了一些他当年写简历的方法论，我感觉太牛逼了，实在是忍不住，就分享了出来，希望能够帮助到你。 01、简历的本质 作为简历的撰写者，你必须要搞清楚一点，简历的本质是什么，它就是为了来销售你的价值主张的。往深...
 魂迁光刻，梦绕芯片，中芯国际终获ASML大型光刻机
据羊城晚报报道，近日中芯国际从荷兰进口的一台大型光刻机，顺利通过深圳出口加工区场站两道闸口进入厂区，中芯国际发表公告称该光刻机并非此前盛传的EUV光刻机，主要用于企业复工复产后的生产线扩容。 我们知道EUV主要用于7nm及以下制程的芯片制造，光刻机作为集成电路制造中最关键的设备，对芯片制作工艺有着决定性的影响，被誉为“超精密制造技术皇冠上的明珠”，根据之前中芯国际的公报，目...
 优雅的替换ifelse语句
场景 日常开发，ifelse语句写的不少吧？？当逻辑分支非常多的时候，ifelse套了一层又一层，虽然业务功能倒是实现了，但是看起来是真的很不优雅，尤其是对于我这种有强迫症的程序"猿"，看到这么多ifelse，脑袋瓜子就嗡嗡的，总想着解锁新姿势：干掉过多的ifelse！！！本文将介绍三板斧手段： 优先判断条件，条件不满足的，逻辑及时中断返回； 采用策略模式+工厂模式； 结合注解，锦...
 离职半年了，老东家又发 offer，回不回？
有小伙伴问松哥这个问题，他在上海某公司，在离职了几个月后，前公司的领导联系到他，希望他能够返聘回去，他很纠结要不要回去？ 俗话说好马不吃回头草，但是这个小伙伴既然感到纠结了，我觉得至少说明了两个问题：1.曾经的公司还不错；2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说，松哥之前也有过类似的经历，今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点，就是离职了也没必要和老东家弄的苦...
 2020阿里全球数学大赛：3万名高手、4道题、2天2夜未交卷
阿里巴巴全球数学竞赛（ Alibaba Global Mathematics Competition）由马云发起，由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛，全世界爱好数学的人都可参与，不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...
 为什么你不想学习？只想玩？人是如何一步一步废掉的
不知道是不是只有我这样子，还是你们也有过类似的经历。 上学的时候总有很多光辉历史，学年名列前茅，或者单科目大佬，但是虽然慢慢地长大了，你开始懈怠了，开始废掉了。。。 什么？你说不知道具体的情况是怎么样的？ 我来告诉你： 你常常潜意识里或者心理觉得，自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间，还有无限的可能，自己还能逆风翻盘，只不是自己还没开始罢了，自己以后肯定会变得特别厉害...
 百度工程师，获利10万，判刑3年！
所有一夜暴富的方法都写在刑法中，但总有人心存侥幸。这些年互联网犯罪高发，一些工程师高技术犯罪更是引发关注。这两天，一个百度运维工程师的案例传遍朋友圈。1...
 程序员为什么千万不要瞎努力？
本文作者用对比非常鲜明的两个开发团队的故事，讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境，那么即使勤劳努力，不仅会极其耗时而且成果甚微，使用...
 为什么程序员做外包会被瞧不起？
二哥，有个事想询问下您的意见，您觉得应届生值得去外包吗？公司虽然挺大的，中xx，但待遇感觉挺低，马上要报到，挺纠结的。
 当HR压你价，说你只值7K，你该怎么回答？
当HR压你价，说你只值7K时，你可以流畅地回答，记住，是流畅，不能犹豫。 礼貌地说：“7K是吗？了解了。嗯~其实我对贵司的面试官印象很好。只不过，现在我的手头上已经有一份11K的offer。来面试，主要也是自己对贵司挺有兴趣的，所以过来看看……”（未完） 这段话主要是陪HR互诈的同时，从公司兴趣，公司职员印象上，都给予对方正面的肯定，既能提升HR的好感度，又能让谈判气氛融洽，为后面的发挥留足空间。...
 面试：第十六章：Java中级开发（16k）
HashMap底层实现原理，红黑树，B+树，B树的结构原理 Spring的AOP和IOC是什么？它们常见的使用场景有哪些？Spring事务，事务的属性，传播行为，数据库隔离级别 Spring和SpringMVC，MyBatis以及SpringBoot的注解分别有哪些？SpringMVC的工作原理，SpringBoot框架的优点，MyBatis框架的优点 SpringCould组件有哪些，他们...
 面试阿里p7，被按在地上摩擦，鬼知道我经历了什么？
面试阿里p7被问到的问题(当时我只知道第一个)：@Conditional是做什么的?@Conditional多个条件是什么逻辑关系？条件判断在什么时候执...
 无代码时代来临，程序员如何保住饭碗？
编程语言层出不穷，从最初的机器语言到如今2500种以上的高级语言，程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新，一边面临由于许多代码已存在，程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法，它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中，可视化建模来组装和配置应用程序。这样一来，开发者直...
 面试了一个 31 岁程序员，让我有所触动，30岁以上的程序员该何去何从？
最近面试了一个31岁8年经验的程序猿，让我有点感慨，大龄程序猿该何去何从。
 大三实习生，字节跳动面经分享，已拿Offer
说实话，自己的算法，我一个不会，太难了吧
 程序员垃圾简历长什么样？
已经连续五年参加大厂校招、社招的技术面试工作，简历看的不下于万份 这篇文章会用实例告诉你，什么是差的程序员简历！ 疫情快要结束了，各个公司也都开始春招了，作为即将红遍大江南北的新晋UP主，那当然要为小伙伴们做点事（手动狗头）。 就在公众号里公开征简历，义务帮大家看，并一一点评。《启舰：春招在即，义务帮大家看看简历吧》 一石激起千层浪，三天收到两百多封简历。 花光了两个星期的所有空闲时...
 《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版（进大厂必备）
正确选择比瞎努力更重要！
 字节跳动面试官竟然问了我JDBC？
轻松等回家通知
 面试官：你连SSO都不懂，就别来面试了
大厂竟然要考我SSO，卧槽。
 实时更新：计算机编程语言排行榜—TIOBE世界编程语言排行榜（2020年6月份最新版）
内容导航： 1、TIOBE排行榜 2、总榜（2020年6月份） 3、本月前三名 3.1、C 3.2、Java 3.3、Python 4、学习路线图 5、参考地址 1、TIOBE排行榜 TIOBE排行榜是根据全世界互联网上有经验的程序员、课程和第三方厂商的数量，并使用搜索引擎（如Google、Bing、Yahoo!）以及Wikipedia、Amazon、YouTube统计出排名数据。
 阿里面试官让我用Zk（Zookeeper）实现分布式锁
他可能没想到，我当场手写出来了
 终于，月薪过5万了！
来看几个问题想不想月薪超过5万？想不想进入公司架构组？想不想成为项目组的负责人？想不想成为spring的高手，超越99%的对手？那么本文内容是你必须要掌握的。本文主要详解bean的生命...
 能让德国人放弃现金支付，也没谁了
在新冠疫情中，德国人越来越多地选择在超市，加油站或其他商店付款时使用非接触式付款方式。德国信贷协会Deutschen Kreditwirtschaft (DK) 的一位发言人告诉德国新...
 自从喜欢上了B站这12个UP主，我越来越觉得自己是个废柴了！
不怕告诉你，我自从喜欢上了这12个UP主，哔哩哔哩成为了我手机上最耗电的软件，几乎每天都会看，可是吧，看的越多，我就越觉得自己是个废柴，唉，老天不公啊，不信你看看…… 间接性踌躇满志，持续性混吃等死，都是因为你们……但是，自己的学习力在慢慢变强，这是不容忽视的，推荐给你们！ 都说B站是个宝，可是有人不会挖啊，没事，今天咱挖好的送你一箩筐，首先啊，我在B站上最喜欢看这个家伙的视频了，为啥 ，咱撇...
 博客 在中国程序员是青春饭吗？
 博客 程序员请照顾好自己，周末病魔差点一套带走我。
 博客 Java基础知识面试题（2020最新版）
 博客 技术大佬：我去，你写的 switch 语句也太老土了吧
 博客 和黑客斗争的 6 天！
 博客 Intellij IDEA 实用插件安利
 博客 女程序员，为什么比男程序员少？？？
 博客 总结了 150 余个神奇网站，你不来瞅瞅吗？
 博客 副业收入是我做程序媛的3倍，工作外的B面人生是怎样的？
 博客 MySQL数据库面试题（2020最新版）
 博客 如果你是老板，你会不会踢了这样的员工？
 博客 我入职阿里后，才知道原来简历这么写
 博客 魂迁光刻，梦绕芯片，中芯国际终获ASML大型光刻机
 博客 优雅的替换ifelse语句
 博客 离职半年了，老东家又发 offer，回不回？
 博客 2020阿里全球数学大赛：3万名高手、4道题、2天2夜未交卷
 博客 为什么你不想学习？只想玩？人是如何一步一步废掉的
 博客 男生更看重女生的身材脸蛋，还是思想？
 博客 为什么程序员做外包会被瞧不起？
 博客 当HR压你价，说你只值7K，你该怎么回答？
 博客 面试：第十六章：Java中级开发
 博客 面试阿里p7，被按在地上摩擦，鬼知道我经历了什么？
 博客 Python爬虫，高清美图我全都要（彼岸桌面壁纸）
 博客 差点跪了...
 博客 面试了一个 31 岁程序员，让我有所触动，30岁以上的程序员该何去何从？
 博客 Vue回炉重造之router路由（更新中）
 博客 大三实习生，字节跳动面经分享，已拿Offer
 博客 程序员垃圾简历长什么样？
 博客 Java岗开发3年，公司临时抽查算法，离职后这几题我记一辈子
 博客 大胆预测下未来5年的Web开发