Created
January 4, 2016 16:09
-
-
Save Jack-Saleem/ee86434f93e4a79f67aa to your computer and use it in GitHub Desktop.
Codeforces 38A Army program in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Army | |
{ | |
public static void main(String[] args) | |
{ | |
Scanner z=new Scanner(System.in); | |
int n=z.nextInt(); | |
int[] ar=new int[n-1]; | |
for(int i=0;i<ar.length;i++) | |
ar[i]=z.nextInt(); | |
int a=z.nextInt(); | |
int b=z.nextInt(); | |
int temp=0; | |
for(int i=a;i<b;i++) | |
temp+=ar[i-1]; | |
System.out.println(temp); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment