[JAVA] paiza Code Girl Collection #Gull this

  URL
Code Girl Collection https://qiita.com/cielavenir/items/ea97544089a5a3ca686f
Code Chord Chord https://qiita.com/cielavenir/items/3124ec862325682d381d

――As I can say from the time of Code Gym beta, I wonder if it is really good to do multiple quick-solving problems. ――If you are serious, you only have to do the exercises of paiza learning. ――Conversely, by starting the game after completing the first part of paiza learning basics, you can get 6 diamonds in almost one shot.

Below, I don't care about the ranking, so I will write what I want to write. (It seems that some people are pushing the automatic answer script to raise the ranking, so it is no longer barren)

200307

--I got 52380 points in the primary girl "Diaochan" (score 8%). What does this mean? .. Did the language in the code chronicle also replace the problem?

160906

――I got 35587 points in the primary girl "Samurai" (score 7%). Update after a long time.

Common

--1 == x will be evaluated in any language without any problems. If it is easier to hit than x == 1, go aggressively.

Ruby

Leap year judgment

--You can use Date # leap?. It seems that it was a problem like date = Date.now; if date.leap? .... Note that it is not leep?. ――But how about recommending leap? To beginners? You really should write the logic.

random number

--rand (start..stop).

Range reverse order

--You can use (start..stop) .to_a.reverse, you can also use [* start..stop] .reverse, or you can use (start..stop) to adjust the output. Of course there is. -By the way, I personally don't recommend the for statement in Ruby. In other wordsstop.downto(start) do |i|Is the correct answer.I give up because it's hard to hit. -[Addition] It seems good to put stop.down to start after for. No parentheses required.

Last two digits of the year

--Pass by year% 100. It's actually sprintf ('% 02d', year% 100), but I don't want to write something that seems so long.

PHP

Mental arithmetic

--In PHP, words written outside <? Php ...?> Have the property of being simply echoed, so mental arithmetic (for problems that do not take input), clear the answer screen, and answer. Is the fastest to write and execute.

Early stage

――It is quite difficult to hit $ x. $ Y. $ Z in 5 seconds to aim for 6 diamonds, but since the time limit will be longer after the middle stage, let's hit it hard ... The rest of the luck of the problem.

date --Year date ('Y') 2 digits date ('y') --Month date ('n') --Day date ('j') --Leap year date ('L')

Python

version

--When I checked it with paiza learning, it was 3.4.3. Note that ** print requires parentheses and input is input () **. Also, 448/14 == 32 **. 0 **.

leap year

--As suggested by the import statement, it is ʻisleap (year)`.

random number

--random.randint (start, end).

Java

Early stage

――If you aim at 6 diamonds, it will be affected by typing speed, so it is good to put System.out.println (""); on the clipboard.

random number

--new Random (). nextInt (end-start) + start. It's a hassle, so let's fix it to 1.

C

Early stage

--Copy "printf".

String concatenation

--printf ("% s% s% s", s1, s2, s3); is fine. This problem setting is not good in C.

random number

--rand ()% (end-start) + start.

this year

Miss

--There is a code that says "eles" for only one question, but of course it is a syntax error and needs to be fixed. ――It's hard because it's a part that has nothing to do with the essence of the problem (if the answer is incorrect, can I get a syntax error?)

C# ##

――For some reason, the time limit for 6 diamonds is 60 seconds, so it's much easier than in other languages. Make other languages 60 seconds (which is easier for beginners).

Miss

--The question is "output the result of dividing 448 to 14", but the answer is ** 31 **. There is nothing you can do, so please embed the answer. ――I think there was a rotten language that became 31, but what was it ... ――I remember that it was a minor language, but no matter what.

random number

--new Random (). Next (end-start + 1) + start.

C++

-** See also the C section except for C ++ specific features. ** ** --This applies to only a small part of the output problem, but if the output is one line, << endl; is not needed.

include <cstdlib>

--paiza [adopts clang] for the C / C ++ execution environment (https://paiza.jp/guide/language). --rand () can only be used without cstdlib in clang. ** Please note that it is necessary for gcc. ** **

Miss

--If the problem of x == 2 is incorrect, try reinitializing x = 1 to x = 2.

JavaScript

Semi-comma

--No semi-comma at the end of the line is required.

random number

--parseInt (Math.random () * (end-start)) + start.

Recommended Posts

paiza Code Girl Collection #Gull this
Spark Dataframe Sample Code Collection