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 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!
#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--;
}
}
}
}