Saratov State University :: Online Contester


::Go
- home
- news
- register
- update personal info
- problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- links
- projects

::Poll
Are you registered on Codeforces?
Yes
No
What is it???

[results]

::webboard

I solved my problem but again there is WA on test 39.
Author: SamiraG
ID: 055799
Problem: 181
Contest: 0
Date: 2013-06-16 23:14:04

I need your help
I changed my program to this:
#include<iostream>
using namespace std;
int main()
{
int aa,a,b,g,m,x[1010],f;
unsigned long k;
cin>>aa>>a>>b>>g>>m>>k;
x[0]=aa;

for(unsigned long i=1;i<=m+1;i++)
{
x[i]=((a * x[i-1] * x[i-1] )+ (b * x[i-1]) + g)% m;
}
if(k<m+2)cout<<x[k];
else
{
for(int i=m;i>=1;i--)
if(x[i]==x[m+1])
{
f=m-i+1;
cout<<x[i+((k-i)%f)];
break;
}
}
//system("pause");
}


see sub-tree reply to that message


::Login
Forgot password?

::News
22.10.12 - The problems from the Southern Subregional Programming Contest 2012 added to the problemset archive (542 - 553).
22.10.12 - After the start of the contest the statements in PDF will be available by the link.
23.10.11 - The problems from the Southern Subregional Programming Contest 2011 added to the problemset archive (530 - 541).

::Counter

Server time: 2017-09-22 20:58:33Online Contester Team © 2002 - 2016. All rights reserved.