답안 #3745

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
3745 2013-08-31T08:04:55 Z qja0950 Following Flow (kriii1_F) C++
컴파일 오류
0 ms 0 KB
#include <stdio.h>
int n, m;
int line[31][31][2];
int x, y, z, cnt, now, how;
double plus[51][31], ans=0;
int times;
int main() {
	freopen("input.txt", "r", stdin);
	scanf("%d %d", &n, &m);
	int i, j;
	for(i=1; i<=m; i++) {
		scanf("%d %d %d", &x, &y, &z);
		line[x][0][0]++;
		line[x][line[x][0][0]][0]=y;
		line[x][line[x][0][0]][1]=z;
	}
	plus[0][#include <stdio.h>
int n, m;
int line[31][31][2];
int x, y, z, cnt, now, how;
double plus[51][31], ans=0;
int times;
int main() {
	freopen("input.txt", "r", stdin);
	scanf("%d %d", &n, &m);
	int i, j;
	for(i=1; i<=m; i++) {
		scanf("%d %d %d", &x, &y, &z);
		line[x][0][0]++;
		line[x][line[x][0][0]][0]=y;
		line[x][line[x][0][0]][1]=z;
	}
	plus[0][0]=1;
	while(times<=1000) {
		for(i=0; i<n; i++) {
			how=line[i][0][0];
			if(how==0 || plus[times%51][i]==0) continue;
			for(j=1; j<=how; j++) {
				plus[(times+line[i][j][1])%51][line[i][j][0]]+=(1./how)*plus[times%51][i];
			}
			plus[times%51][i]=0;
		}
		if(plus[times%51][n]!=0) {
			ans+=(plus[times%51][n]*times);
			plus[times%51][n]=0;
		}
		times++;
	}
	printf("%.9lf", ans);
	return 0;
}
}
		times++;
	}
	printf("%.9lf", ans);
	return 0;
}

Compilation message

F.cpp:17:2: error: stray '#' in program
F.cpp: In function 'int main()':
F.cpp:17:11: error: 'include' was not declared in this scope
F.cpp:17:20: error: 'stdio' was not declared in this scope
F.cpp:18:1: error: expected primary-expression before 'int'
F.cpp:18:1: error: expected ']' before 'int'
F.cpp:18:1: error: expected ';' before 'int'
F.cpp:23:12: error: a function-definition is not allowed here before '{' token
F.cpp:10:9: warning: unused variable 'j' [-Wunused-variable]
F.cpp:19:5: warning: unused variable 'line' [-Wunused-variable]
F.cpp:20:5: warning: unused variable 'x' [-Wunused-variable]
F.cpp:20:8: warning: unused variable 'y' [-Wunused-variable]
F.cpp:20:11: warning: unused variable 'z' [-Wunused-variable]
F.cpp:20:14: warning: unused variable 'cnt' [-Wunused-variable]
F.cpp:20:19: warning: unused variable 'now' [-Wunused-variable]
F.cpp:20:24: warning: unused variable 'how' [-Wunused-variable]
F.cpp:21:8: warning: unused variable 'plus' [-Wunused-variable]
F.cpp:21:22: warning: unused variable 'ans' [-Wunused-variable]
F.cpp:22:5: warning: unused variable 'times' [-Wunused-variable]
F.cpp:57:1: error: expected '}' at end of input
F.cpp:8:34: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
F.cpp:9:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
F.cpp:12:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]