I Did Not Do the Assignment

Professor Petr is very angry over some of his students now-a-days for not doing assignment. He wants…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

  • The input can be 1 to 1000. If your code works in that range, your submission will be accepted.
    তুমি ২০ পর্যন্ত ইনপুট করে চেক করেছ যে কাজ করছে, যদি জাজ দ্বিতীয় রানিং-এ ২১ দিয়ে চেক করে তোমার প্রোগ্রাম? তখন তো ভুলও দেখাতে পারে, তাই না? কারণ তুমি তো ২১ বা এর পরের কোনো সংখ্যা দিয়ে চেক করোনি। ২১ না শুধু, জাজ ১০০০ এর ভিতর যেকোনো সংখ্যা দিয়েই তোমার প্রোগ্রাম চেক করতে পারে। তাই তোমার প্রোগ্রামকে এমন হতে হবে, যেন ১ থেকে ১০০০ এর মধ্যে যে সংখ্যাই দেয়া হোক না কেন, তোমার প্রোগ্রাম যাতে সঠিক আউটপুট দিতে পারে।
1 Like
#include <stdio.h>

void main(){

    int num,i,ctr=0;
    scanf("%d",&num);
    for(i=2;i<=num/2;i++){
        if(num % i==0){
         ctr++;
            break;
        }
    }
   if(ctr==0 && num!= 1)
        printf("NO PUNISHMENT");
   else
      printf("I DID NOT DO THE ASSIGNMENT.");
}

problem???

You need to print "I DID NOT DO THE ASSIGNMENT." n number of time. which mean if n is not prime you have to print "I DID NOT DO THE ASSIGNMENT." n number of time.


can’t understand what is wrong here :disappointed_relieved: anybody help pls

You probably have left a whitespace after the fullstop

print(“I DID NOT DO THE ASSIGNMENT.”)
print("I DID NOT DO THE ASSIGNMENT. ")

A whitespace may cause it output a WA

1 Like

Try this:
def is_prime(x):
if x == 1:
return False
else:
for i in range(1,int(x**0.5)+1):
if i!=1 and x%i == 0:
return False
return True
n = int(input())
if is_prime(n):
print(‘NO PUNISHMENT’)
else:
for i in range(0,n):
print(‘I DID NOT DO THE ASSIGNMENT.’)

Don’t just give people the full solution.
(If they really want to see it, they can always check others’ submissions)

Instead, try to guide them in the right direction.
Help them spot where they might be going wrong.

That way, they’ll actually understand the problem
and be able to solve it on their own.

Thank you for your valuable advice. I’ll never do such mistake at all. I have never told anyone any solution even not cleared their doubt or mistake. But suddenly he requested like he was in great trouble, I felt sad cause I have also gone through that hardship and thought he does so. And thus being very emotional, I directly told the solution. But now I’ll clear their doubts and inform their mistakes that they make. And I’ll be grateful to you for your advice. Thank you :slight_smile:.