What kind of comment should I post on the problem page?

package com.bhawna.CodeChef.easy;

import java.util.Scanner;

public class LuckyLong {

public static void main(String args[])
{
	int number,mod,count=0;
	Scanner scan=new Scanner(System.in);
	System.out.println("Enter the number of test cases");
	int testCases=scan.nextInt();
	while(testCases>0)
	{
		count=0;
		System.out.println("Enter a number");
		number=(scan.nextInt());
		while(number>0)
		{
			mod=number%10;
			if((mod%7==0||mod%4==0))
			{
				
			}
			else
			{
				count++;
			}
			number=number/10;
		}
		System.out.println(count);
		testCases--;
		
	}
}

}

#include<stdio.h>
#include<string.h>
main();
{
int n;
char c[2],k[2];
int i,t;
//printf(“enter the no of names”);
scanf("%d",&n);
for(t=0;t<n;t++)
{
scanf("%s",&c[t]);
scanf("%s",&k[t]);
}
strcmp (c[t],k[t]);
if (strcmp(c[t],k[t])==1)
{
printf("%s",k[t]);
}
for(t=0;t<n;t++)
{
i=atoi(c[t]);
printf(" %d",i);
}
return 0;
}

I AM NOT GETTING UR QUES MATRIX IN MARCH CHALLENGE ,WHAT IS THE DIFFERENCE BETWEEN QUERY 5&7

It says “Wrong Answer”.Code is working on my desktop compiler.
Here is the code.

Please help!

#include<stdio.h>

int main()
{
int i=0,j=0,max1=0,max2=0;
scanf("%d",&i);
int n[i],o[i];

while(j<i)
{
scanf("%d %d",&n[j],&o[j]);
j++;
}
j=0;
while(j<i)
{
	if(max1<(n[j]-o[j]))
	max1=n[j]-o[j];
	if(max2<(o[j]-n[j]))
	max2=o[j]-n[j];	
	j++;	
}
if(max1>max2)
printf("1 %d",max1);
else
printf("2 %d",max2);

return 0;
	}

why i am getting wa on my problem

As I have karma = 1, I cannot comment on the problems of June challenge (I can, but it says “you comment screened out till admin’s approval”, and I got no answers yet), neither I can create new threads in discussions :frowning:

So, probably, someone will see my comment here and will comment on my behalf that I have strong suspicions that the problem CHPLGNS of June’s Challenge has incorrect test data set #9. If you solve the problem honestly testing for each pair of the polygons, which one is contained inside another one, it will detect that in the data set #9 there is a pair of polygons not lying one inside another (my implementation of this approach correctly passes all other test cases, showing, by the way, that in the test cases #### 4, 10 some of the polygons touch each other, though task’s authors replied many times in the comments that it never happens). So, there is another, simpler approach to solve the problem, valid if it is guaranteed, as in the task condition, that for each pair of the polygons one of them contains another. And this approach passes the set #9, though, in no way it really checks that the test-set satisfies task conditions.

s there something in specific that needs to be done to get my queries answered? I have posted queries adhering to the above mentioned guidelines and still never get a response, can you explain a reason why this could be the case. Thanks in advance…!

Is it okay to comment something funny ? Like I was reading this problem on bread and I commented saying “I feel like eating Garlic Bread after Reading this problem statement :smiley: Heheheh” and I guess the admin dint approve it. Why ? Is it so bad to post some humor ?

//Chef and way in JAVA
import java.util.*;
class Chefstreet1
{
static Scanner sc=new Scanner(System.in);
public static void main(String[] args)
{
int n=sc.nextInt();;
int k=sc.nextInt();
int mat[]=new int[n];

	int a=1;
	for (int i=0;i<n ;i++ )
	{
		mat[i]=a;
		a++;
	}
	for (int i=0;i<n ;i++ )
	{
		System.out.print(mat[i]);
	}
	System.out.println();

	
	int g=0;
	for (int i=0;i<n-1 ;i++ )
	{
		for (int j=0;j<n-1 ;j++ )
		{
			if (mat[j]>mat[j+1])
			{
				g=mat[j];
				mat[j]=mat[j+1];
				mat[j+1]=g;
			}
		}
	}
	
	int q=0;
	int min=0;


	for (int i=1;i<n-1 ;i++ )
	{
		if(((mat[i]-mat[1])<=k)&&((mat[n-1]-mat[i])<=k))
		{
		q=mat[n-1]-mat[i];
		}
		
		q=mat[n-1]*mat[i];

		if ((q>min)&&(min==0))
		{
			min=q;
		}
		else if (q<min)
		{
			min=q;
		}
		
	}
	System.out.println(min);

}

}

As I post a comment in a live competition as well as on an old question, the comment turn up red!?

If these are the rules, what is the need to create a comment section ?
Don’t clarify the doubts.
Don’t ask questions. etc etc.
How can we develop coding skills then without getting even proper assistance ?

#include<stdio.h>

int main()
{
float x[10000],y[10000];
int T,N,i,S1,S2;
scanf("%d",&T);
scanf("%d\n",&N);
if (N%2!=0)
{for(i=0;i<N;i++)
{
scanf("%f",&x[i]);
S1+=x[i];
scanf("%f",&y[i]);
S2+=y[i];

	}
}

if (N%2==0)
{
for(i=0;i<N/2;i++)
{
scanf("%f",&x[i]);
S1+=x[i];
scanf("%f",&y[i]);
S2+=y[i];

	}
	for(i=N/2;i<N;i++)
	{
		scanf("%f",&y[i]);
		S2+=y[i];
		scanf("%f",&x[i]);
		S1+=x[i];
		
	}
	
}

if (S1<S2)
	printf("%d",S1);
else
	printf("%d",S2);

}

Can you tell me what mistake i have made

#include<stdio.h>

int main()
{
int N,i,j,T,Tx=0,Ty=0;

scanf("%d",&T);
scanf("%d",&N);
int x[N],y[N];
for(i=0;i<N;i++)
    scanf("%d",&x[i]);for(i=0;i<N;i++)scanf("%d",&y[i]);
i=0;
for(i=0;i<N-1;i=i+2)
    Tx=Tx+x[i]+y[i+1];
if(i==N-1)
    Tx=Tx+x[i];
j=0;
for(j=0;j<N-1;j=j+2)
    Ty=Ty+y[j]+x[j+1];
if(j==N-1)
    Ty=Ty+y[j];
printf("%d",(Tx>Ty?Ty:Tx));
return 0;

}
whats wrong with my code for begineers first problem?

I am here to practice and improve my coding skills. Here, the problem statement contains a simple testcase, whereas the problem can contain complex testcases. Without knowing what went wrong how can I be able to solve the problem. At least give us two testcases instead of One, like one is complex and the other is simple.

You can post any comment!

1 Like

#include <bits/stdc++.h>
using namespace std;

int main()
{
long long t;
cin >> t;
long long num;
while(t–)
{
cin>>num;
if(num==0)
{
cout<<0<<" “<<0<<endl;
}
if(num==1)
{
cout<<1<<” “<<0<<endl;
}
if(num==2)
{
cout<<1<<” "<<1<<endl;
}

    if(num>=3)
    {
        int s;
        s = num % 3;
        if(s==1)
        {
            int a;
            a = num/3;
            cout<<a+1<<" "<<a*2<<endl;
        }
        if((s==2) && (num%2==1))
        {
          int b;
          b = num/3;
          cout<<b*2<<" "<<b*2+1<<endl;   
        }
        if((s==2) && (num%2==0))
        {
          int b;
          b = num/3;
          cout<<b+1<<" "<<b*2+1<<endl;   
        }
        if(num%3==0)
        {
          int q;
          q = num/3;
          cout<<q<<" "<<q*2<<endl;
        }
    }
}


return 0;

}

#include <bits/stdc++.h>
using namespace std;

int main()
{
long long t;
cin >> t;
long long num;
while(t–)
{
cin>>num;
if(num==0)
{
cout<<0<<" “<<0<<endl;
}
if(num==1)
{
cout<<1<<” “<<0<<endl;
}
if(num==2)
{
cout<<1<<” "<<1<<endl;
}

    if(num>=3)
    {
        int s;
        s = num % 3;
        if(s==1)
        {
            int a;
            a = num/3;
            cout<<a+1<<" "<<a*2<<endl;
        }
        if((s==2) && (num%2==1))
        {
          int b;
          b = num/3;
          cout<<b*2<<" "<<b*2+1<<endl;   
        }
        if((s==2) && (num%2==0))
        {
          int b;
          b = num/3;
          cout<<b+1<<" "<<b*2+1<<endl;   
        }
        if(num%3==0)
        {
          int q;
          q = num/3;
          cout<<q<<" "<<q*2<<endl;
        }
    }
}


return 0;

}

I am able to run and execute my code in my desktop perfectly but in this interpreter i am getting wrong answer . What’s the problem in that

package code.com;

import java.util.Scanner;

public class LuckyLong {
public static void main(String args[]){

    int number,mod,count=0;
    Scanner scan=new Scanner(System.in);
    System.out.println("Enter the number of test cases");
    int testCases=scan.nextInt();
    while(testCases>0)
    {
        count=0;
        System.out.println("Enter a number");
        number=(scan.nextInt());
        while(number>0)
        {
            mod=number%10;
            if((mod%7==0||mod%4==0))
            {

            }
            else
            {
                count++;
            }
            number=number/10;
        }
        System.out.println(count);
        testCases--;

    


    int number1,mod1,count1=0;
    Scanner scn=new Scanner(System.in);
    System.out.println("Enter the number of test cases");
    int testCases1=scn.nextInt();
    while(testCases1>0)
    {
        count1=0;
        System.out.println("Enter a number");
        number1=(scan.nextInt());
        while(number1>0)
        {
            mod1=number1%10;
            if((mod1%7==0||mod1%4==0))
            {

            }
            else
            {
                count1++;
            }
            number1=number1/10;
        }
        System.out.println(count1);
        testCases1--;

    }
}
}

}

And what about “Java is too slow for this problem (TLE), same algorithm in C/C++ works fine.” hint? I think, it is similar to “Warning: large Input/Output data, be careful with certain languages” warning. Because there are such problems, in which time limit multiplication is not enough. And if someone is programming only in Java he/she has no chance to solve such problem, so this hint simply tells “skip this one”.

6 Likes