#include<cstdio> #include<cstring> #include<cstdlib> const int bk[] = { 0, 200, 275, 325, 400, 475, 575, 675, 800, 900, 1000}; const int team[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}; char s[15][30], a[30], b[30]; int m[15], kill[15], n; int findbuf( char *x) { int i; for( i = 1; i <= 10; i ++) if( strcmp( s[i], x) == 0) return i; } void cal( char *a, char *b) { int x = findbuf(a), y = findbuf(b); if( strcmp( a, b) == 0) return; if( team[x] == team[y]) { if( kill[y] >= 0) m[y] -= 200; else m[y] -= bk[ -( kill[y] + 1) ]; kill[y] = 0; } else { if( kill[x] <= 0) { kill[x] = 1; } else kill[x] ++; if( kill[x] > 10) kill[x] = 10; if( kill[y] > 0) kill[y] = -1; else kill[y] --; if( kill[y] < -10) kill[y] = -10; m[x] += bk[ kill[x]]; m[y] -= bk[ -kill[y]]; } if( m[y] < 0) m[y] = 0; } int main() { while( scanf( "%s", s[1]) != EOF) { m[1] = 4726; kill[1] = 0; for( int i = 2; i <= 10; i ++) { scanf( "%s", s[i]); m[i] = 4726; kill[i] = 0; } scanf( "%d", &n); while( n --) { scanf( "%s%s", a, b); cal( a, b); //printf( "%d %d %d %d\n", kill[findbuf(a)], kill[findbuf(b)], m[findbuf(a)], m[findbuf(b)]); } for( int i = 1; i <= 10; i ++) { printf( "%d\n", m[i]); } } return 0; }
转载于:https://www.cnblogs.com/Yu2012/archive/2012/04/17/2453080.html