You are not logged in. Please login at www.codechef.com to post your questions!

×

spoj apoorv and math problem

# include <bits/stdc++.h>
# define ll long long 
using namespace std;
void sieve(ll n)
{
    ll prod=1;
//memset(a,true,sizeof(a));
ll i;
for( i= 1 ;i*i<n; i++)
{
    if(n%i==0)
prod=((prod%1000000007)*(i%1000000007))%1000000007;
}
cout<<((prod)%1000000007*(n%1000000007))%1000000007;

}
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
    ll n;
ll tc;
cin>>tc;
while(tc--)
{

cin>>n;
sieve(n);
}
}
//THIS CODE GIVES TLE SINCE COMPLEXITY IS o(100*N^1/2)

asked 23 Sep '17, 11:48

sdev0245's gravatar image

1★sdev0245
11
accept rate: 0%

edited 23 Sep '17, 13:48

vijju123's gravatar image

4★vijju123 ♦♦
15.2k11859

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×18

question asked: 23 Sep '17, 11:48

question was seen: 157 times

last updated: 23 Sep '17, 13:48