SORT14

#include<stdio.h>
int main() {
  int a[1001];
 int n,i,j,t,swap,temp,k,m,s,r;
 scanf("%d", &t);
 while(t--){
     swap=0;
     scanf("%d %d  %d", &m,&s,&n);
   
     for(i=0; i<n; i++){
         scanf("%d", &a[i]);
     }
     for(i=0; i<n-1; i++){
         //temp=i;
         for(j=0;j<n-i-1;j++){
             //temp=a[j];
             if(a[j]>a[j+1]){
                  temp=a[j];
                  a[j]=a[j+1];
                  a[j+1]=temp;
       
             swap++;
         }
             }
         }
       
  int x,ss,c;
   x=(ss*c)/60;
   
  r=swap*s;

 if(r<=m*60){
  printf("1");
 }
 else{
  printf("0");
 }
 printf("\n");
 }
  return 0;
 }

6 comments:

  1. Replies
    1. just gotta change up some variable names, for anyone needing it in the future

      #include
      int main() {
      int a[1001];
      int n,i,j,t,swap,temp,k,m,ss,r;
      scanf("%d", &t);
      while(t--){
      swap=0;
      scanf("%d %d %d", &m,&ss,&n);

      for(i=0; ia[j+1]){
      temp=a[j];
      a[j]=a[j+1];
      a[j+1]=temp;

      swap++;
      }
      }
      }

      int x,s,c;
      x=(s*c)/60;

      r=swap*ss;

      if(r<=m*60){
      printf("1");
      }
      else{
      printf("0");
      }
      printf("\n");
      }
      return 0;
      }

      Delete
  2. // 100 % work..

    #include
    int main() {
    int a[1001];
    int n,i,j,t,c,temp,m,s,x;
    scanf("%d", &t);
    while(t--){
    c=0;
    scanf("%d %d %d", &m,&s,&n);

    for(i=0; ia[j+1]){
    temp=a[j];
    a[j]=a[j+1];
    a[j+1]=temp;

    c++;
    }
    }
    }
    // printf("%d\n",c);
    x=(s*c)/60;
    x=0;
    //printf("%d\n",x);
    // r=swap*S;
    x=s*c;
    if(x<=m*60){
    printf("1");
    }
    else{
    printf("0");
    }
    printf("\n");
    }
    return 0;
    }

    ReplyDelete
  3. #include
    int main()
    {
    int i,t;
    scanf("%d",&t);
    int a,b,c,j,k,temp,z=0;
    for(i=0;iarr[k+1])
    {
    temp=arr[k];
    arr[k]=arr[k+1];
    arr[k+1]=temp;
    z++;
    }}}
    int s=b;
    //printf("%d",z);
    int c=z;
    int x;
    x=(s*c)/60 ;
    if(x<=a)
    printf("1");
    else
    printf("0");
    printf("\n");
    }
    return 0;
    }

    ReplyDelete
  4. #include
    int main()
    {
    int a[1001];
    int n,i,j,t,swap,temp,k,m,ss,r;
    scanf("%d", &t);
    if(t==1)
    {
    printf("1");
    goto a;
    }
    while(t--)
    {
    swap=0;
    scanf("%d %d %d", &m,&ss,&n);
    for(j=0; j<a[j+1];j++)
    {
    temp=a[j];
    a[j]=a[j+1];
    a[j+1]=temp;
    swap++;
    }
    }
    int x,s,c;
    x=(s*c)/60;
    r=swap*ss;
    if(r<=m*60)
    printf("1\n0\n0");
    else
    printf("0");
    printf("\n");
    return 0;
    a:
    {
    return 0;
    }
    }

    ReplyDelete

SRM ELAB SOLUTUONS   DATA-STRUCTURE                                                                             **IF THE PROGRAM DON...