Skip to content

Instantly share code, notes, and snippets.

@luccasiau
Created March 27, 2015 01:16
Show Gist options
  • Save luccasiau/77bda91e3ab3376c10e0 to your computer and use it in GitHub Desktop.
Save luccasiau/77bda91e3ab3376c10e0 to your computer and use it in GitHub Desktop.
import java.io.*;
public class solucao{
public static void main(String[] args)throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
int i,qtd,n,c,x;
String[] aux;
while(true){
n = Integer.parseInt(in.readLine());
if(n == 0)break;
qtd = 0;
for(i = 0; i < n; i++){
aux = in.readLine().split(" ");
c = Integer.parseInt(aux[0]);
x = Integer.parseInt(aux[1]);
c = (int) Math.floor(x/2);
qtd += c;
}
qtd /= 2;
out.write(qtd+"\n");
}
out.flush();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment