[ create a new paste ] login | about

Link: http://codepad.org/vdgUmw6a    [ raw code | output | fork ]

hoaithu.melody - C++, pasted on Jun 1:
//partition1
import java.util.Scanner;

class Solution
{
 public static void main(String args[]) throws Exception
 {
  Scanner sc=new Scanner(System.in);
  int T=sc.nextInt();
  for (int t = 1; t <= T; t++) {
   int n=sc.nextInt();
   int A[]=new int[n];
   for (int i = 0; i < A.length; i++) {
    A[i]=sc.nextInt();
   }
   int tong =0;
   
   for (int i = 0; i < A.length; i++) {
    tong=tong+A[i];
   }
   
   
  int thoigian=0;
  
  int tem=0;
  int x=0;
  int y=0;
  sapxep(A);
  for (int i = 0; i < A.length-1; i++) {
   
   x=A[i]+A[i+1];
   A[i]=0;
   A[i+1]=x;
   thoigian=thoigian+x;
   sapxep(A);
  }
  
  
  System.out.println("Case #"+t);
   System.out.println(thoigian);
  }

 }
 static void sapxep(int a[]){
  for (int i = 0; i < a.length; i++) {
   for (int j = i; j < a.length; j++) {
    if(a[i]>a[j]){
     a[i]=a[j]+a[i];
     a[j]=a[i]-a[j];
     a[i]=a[i]-a[j];
    }
   }
  }
    }
}


Output:
1
2
Line 2: error: 'import' does not name a type
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: