Codevs 3285 Circle Game

Source: Internet
Author: User

This is the first question of NOIP2013. The end of the first thing you did without reading the question was heavy.

Simplified version Test Instructions: (x+10^k*m)%n.

Fast power chaos.

#include <iostream>
#include <cstdio>
using namespace Std;
Long Long n,m,k,x;
void work ()
{
Long Long R=10%n,ans=1;
while (k!=0)
{
if (k&1)
ans=ans*r%n;
r=r*r%n;
k=k>>1;
}
ans=ans*m%n;
x= (X+ans)%n;
}
int main ()
{
scanf ("%lld%lld%lld%lld", &n,&m,&k,&x);
Work ();
printf ("%lld", X);
return 0;
}

Codevs 3285 Circle Game

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.