답안 #289599

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
289599 2020-09-02T18:52:45 Z FlashGamezzz Kas (COCI17_kas) Java 11
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>

using namespace std;

long dp[100001], temp[100001];
long sum, notes[500];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> notes[i];
		sum += notes[i];
	}
	for (long j = 0; j < 100001; j++){
		dp[j] = 100001;
	}
	dp[0] = 0;
	for (int i = 0; i < n; i++){
		for (long j = 0; j < 100001; j++){
			temp[j] = 100001;
		}
		for (long j = 0; j < 100001; j++){
			temp[j] = min(temp[j], dp[j]+notes[i]);
			temp[abs(j-notes[i])] = min(temp[abs(j-notes[i])], dp[j]);
			temp[j+notes[i]] = min(temp[j+notes[i]], dp[j]);
		}
		for (long j = 0; j < 100001; j++){
			dp[j] = temp[j];
		}
	}
	cout << sum-(sum-dp[0])/2 << endl;
}

Compilation message

kas.java:1: error: illegal character: '#'
#include <iostream>
^
kas.java:1: error: class, interface, or enum expected
#include <iostream>
         ^
kas.java:2: error: illegal character: '#'
#include <cstdlib>
^
kas.java:3: error: illegal character: '#'
#include <cstdio>
^
kas.java:4: error: illegal character: '#'
#include <fstream>
^
kas.java:5: error: illegal character: '#'
#include <algorithm>
^
kas.java:6: error: illegal character: '#'
#include <string>
^
kas.java:7: error: illegal character: '#'
#include <utility>
^
kas.java:8: error: illegal character: '#'
#include <vector>
^
kas.java:12: error: class, interface, or enum expected
long dp[100001], temp[100001];
^
kas.java:13: error: class, interface, or enum expected
long sum, notes[500];
^
kas.java:15: error: class, interface, or enum expected
int main() {
^
kas.java:17: error: class, interface, or enum expected
	cin.tie(NULL);
	^
kas.java:18: error: class, interface, or enum expected
	int n;
	^
kas.java:19: error: class, interface, or enum expected
	cin >> n;
	^
kas.java:20: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	^
kas.java:20: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	                ^
kas.java:20: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	                       ^
kas.java:22: error: class, interface, or enum expected
		sum += notes[i];
		^
kas.java:23: error: class, interface, or enum expected
	}
	^
kas.java:24: error: class, interface, or enum expected
	for (long j = 0; j < 100001; j++){
	                 ^
kas.java:24: error: class, interface, or enum expected
	for (long j = 0; j < 100001; j++){
	                             ^
kas.java:26: error: class, interface, or enum expected
	}
	^
kas.java:28: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	^
kas.java:28: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	                ^
kas.java:28: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	                       ^
kas.java:29: error: class, interface, or enum expected
		for (long j = 0; j < 100001; j++){
		                 ^
kas.java:29: error: class, interface, or enum expected
		for (long j = 0; j < 100001; j++){
		                             ^
kas.java:31: error: class, interface, or enum expected
		}
		^
kas.java:32: error: class, interface, or enum expected
		for (long j = 0; j < 100001; j++){
		                 ^
kas.java:32: error: class, interface, or enum expected
		for (long j = 0; j < 100001; j++){
		                             ^
kas.java:34: error: class, interface, or enum expected
			temp[abs(j-notes[i])] = min(temp[abs(j-notes[i])], dp[j]);
			^
kas.java:35: error: class, interface, or enum expected
			temp[j+notes[i]] = min(temp[j+notes[i]], dp[j]);
			^
kas.java:36: error: class, interface, or enum expected
		}
		^
kas.java:37: error: class, interface, or enum expected
		for (long j = 0; j < 100001; j++){
		                 ^
kas.java:37: error: class, interface, or enum expected
		for (long j = 0; j < 100001; j++){
		                             ^
kas.java:39: error: class, interface, or enum expected
		}
		^
kas.java:42: error: class, interface, or enum expected
}
^
38 errors