|
|
back to boardwhats wrong with my codes?? WA #10 import java.util.*; public class TurnForMEGA { public static void main(String[] args) { Scanner in=new Scanner(System.in); int k=in.nextInt(); int n=in.nextInt(); int sum=0,temp=0; int result=0; int[] array =new int[100]; for(int i=0;i<n;i++){ array[i]=in.nextInt(); } for(int i=0;i<n;i++) { temp=array[i]-k; if(temp>0) { array[i+1]+=temp; } } result=array[n-1]-k; if(result<=0) { result=0; } System.out.print(result); }
} Edited by author 15.02.2015 12:16 Edited by author 15.02.2015 12:16 |
|
|