Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
好水的一道题~~~~注意,输入的数据量大,不宜用cin,用scanf暴减1000+MS,贴个代码参考。#include <stdio.h> #define REP(i,j,k) for(i=j;i<k;i++) int main() { int i,j,k,max,n,m,t=0; int chores[10005]; scanf("%d",&n); REP(i,0,n) { scanf("%d",&chores[i]); scanf("%d",&m); max = 0; REP(j,0,m) { scanf("%d",&k); max =(chores[k-1]>max)?chores[k-1]:max; } chores[i] += max; t = (chores[i]>t)?chores[i]:t; } printf("%d\n",t); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator