ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1586. Threeprime Numbers

Why Wrong answer ?
Posted by ZEXEL 6 Nov 2007 21:39
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
     int i,j,x=0,y=0;
     double n,v,p;
     cout<<"Vesite na4alo diapozona(celoe chislo, min=0,max=100000):";
     cin>>n;
     cout<<"Bedite konec diapozona(celoe chislo, min=0,max=100000):";
     cin>>v;
     if (n==(int)n && n>=0 && n<=100000 && v==(int)v && v>=0 && v<=100000)
     {
          cout<<"\t\t\tProstue chisla ot "<<n<<" do "<<v<<"\n\n";
          for (i=n;i<=v;i++)
          {
               x=0;
               for (j=2;j<i;j++)
               {
                    if (i%j!=0)
                         x++;
               }
               if (x==i-2 && i!=2)
                    cout<<i<<" ";
          }
     }
     else
          cout<<"\nEror intup";

     cin.get();
     cin.get();
     cin.get();
Re: Why Wrong answer ?
Posted by Shyrik 7 Mar 2008 12:39
My english is bad.
It's all program ??.....
Will use dynamic programing f[i,j,z], i - position of digits, on i-th position stay digit j, on (i+1)th position stay digit z.
if j*100 + z*10 + k is prime number then f[i,z,k] = f[i,z,k] + f[i-1,j,z], it's all

Edited by author 07.03.2008 12:42
Re: Why Wrong answer ?
Posted by Nebojsa 22 May 2008 00:12
What is k in this program?