답안 #107032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
107032 2019-04-21T13:35:25 Z gs14004 서울에서 경산까지 (KOI17_travel) C++17
컴파일 오류
0 ms 0 KB
import kotlin.math.*
import java.util.*
import java.math.*

fun main(args : Array<String>) = with(Scanner(System.`in`)) {
	val (n, k) = readLine()!!.trim().split(" ").map{ it.toInt() } 
	var dp = Array(k + 1) { 0 } 
    var nxt = Array(k + 1) { -987654321 }
	for (i in 0..(n-1)){
		val (x1, w1, x2, w2) = readLine()!!.trim().split(" ").map{ it.toInt() } 
        for(j in 0..k) nxt[j] = -987654321;
		for(j in 0..k){
			if(j >= x1) nxt[j] = max(nxt[j], dp[j - x1] + w1);
			if(j >= x2) nxt[j] = max(nxt[j], dp[j - x2] + w2);
		}
        for(j in 0..k) dp[j] = nxt[j];
	}
	println(dp[k])
}

Compilation message

travel.cpp:5:54: error: stray '`' in program
 fun main(args : Array<String>) = with(Scanner(System.`in`)) {
                                                      ^
travel.cpp:5:57: error: stray '`' in program
 fun main(args : Array<String>) = with(Scanner(System.`in`)) {
                                                         ^
travel.cpp:9:12: error: too many decimal points in number
  for (i in 0..(n-1)){
            ^~~
travel.cpp:11:18: error: too many decimal points in number
         for(j in 0..k) nxt[j] = -987654321;
                  ^~~~
travel.cpp:12:12: error: too many decimal points in number
   for(j in 0..k){
            ^~~~
travel.cpp:16:18: error: too many decimal points in number
         for(j in 0..k) dp[j] = nxt[j];
                  ^~~~
travel.cpp:1:1: error: 'import' does not name a type; did you mean 'short'?
 import kotlin.math.*
 ^~~~~~
 short