1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

今回の問題

function Main(input){
    min = 1e18
    max = -1e18
    let abc = "abcdefghijklmnopqrstuvwxyz".split("")
    let ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")
    let f = 3
    if(f == 0){
      input = parseInt(input.trim())
    }
    if(f == 1){
      input = input.trim().split("\n").map((a)=>parseInt(a))
    }
    if(f == 2){
      input = input.trim().split("\n").map((a)=>a.split(" ").map((b)=>parseInt(b)))
    }

    //ここから上は定型文です。
   input = input.split("").map((a)=>parseInt(a))
   input.sort((a,b)=>a-b)
   input = parseInt(input.join(""))
   if(input == 122333){
     console.log("Yes")
   }else{
     console.log("No")
   }
  }
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

工夫した点

"Yes"と出力しなければいけないのは、60通りもあるが、sortしてから試すことによって、122333の一通りを試せば良くなります。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?