Hey man ,
so smart of u . u r right about the check function . it wont work for 25 nor wil it work for 16 or 9 or 36 . There will be a slight change in the operator used in the function , instead of '<' it will be '<=' ,which some how i got it right and submitted the prob and got ac . thanx for u r notice .
Riyad
HOLD ME NOW ,, I AM 6 FEET FROM THE EDGE AND I AM THINKIN.. MAY BE SIX FEET IS SO FAR DOWN
I think you should revise your isprime() function.
For the input 6, your program will output:
6 is prime.
Where the correct output should be 6 is not prime.
Hope this helps!!
There are 3 things one need to be successful : motivation, ability and chance. And if you're a believer, make it four : God's will.
Your isprime function is wrong for 1.
But anyway, as it is said that the input number n is > 1 this is not your problem. What about comparing your output to the sample output? I think you will see your mistake easily
I tried to change my mane, but it is not an option. The board administrators chose not to let us change our name. I guess it's the right choice to prevent people change too many times. I would be confusing.
I don't really care about changing it anmore, but if You do, the only way is to ask the administrators to do it.
They won't do it for a lot of people, though.
I tested my program on all your tests,
I read all topics about 10235 -- Simply Emirp,
but I still get WA.
I apologise for putting my code here, but I can't work out what's wrong -- it seems to be all right :/
A little explanation :
s, os -- numbers read as strings : s -- read normally, os -- read backwards
g, og -- real numbers that I am to check
n, nn -- bools declaring : n -- whether original number is a prime, nn -- whether the same number read backwards is a prime
[pascal]
program miazio;
function odwr (s:string):string;
var
pk:byte;
qpa:string;
begin
pk:=length (s) + 1;
qpa:='';
repeat
dec (pk);
qpa:=qpa + s[pk]
until pk <= 1;
odwr:=qpa;
end;
var
s, os:string;
i, j, l, k, lp, p, g, og:longint;
n, nn:boolean;
kurde:set of char;
An Emirp (Prime spelt backwards) is a Prime that gives you a different Prime when its digits are reversed.
So
11 is not emirp.
You can use seive method.This will help u a lot.