Submission #19504

# Submission time Handle Problem Language Result Execution time Memory
19504 2016-02-24T14:27:05 Z sung927 Α (kriii4_P1) C
Compilation error
0 ms 0 KB
#include<stdio.h>
#include<math.h>

 unsigned long long A;
 unsigned long long perA;
 unsigned long long X;
 unsigned long long arr[65];
 bool Tr[65];
int max;
unsigned long long ans = 1;

void finish(int y, int dex)
{

    if((y%2)) Tr[dex] = 1;

    if(y/2>=1) finish(y/2, dex+1);
}

void solve(int k)
{
    arr[k] = (int)((arr[k-1]*arr[k-1]) % 1000000007);
    if(pow(2,k)<=X) solve(k+1);

    else {max = k; finish(X, 1);}

}

int main ()
{
    scanf("%lld", &A);
    scanf("%lld", &X);
    perA = A % 1000000007;
    arr[1] = perA;

    solve(2);
    int i=1;
    for( ;i<=max+1; i++) {if(Tr[i]) ans*= arr[i]; if(ans>1000000007) ans%=1000000007;}
    printf("%lld", ans);

    }

Compilation message

P1.c:8:2: error: unknown type name ‘bool’
  bool Tr[65];
  ^
P1.c: In function ‘main’:
P1.c:31:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &A);
     ^
P1.c:32:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &X);
     ^
P1.c:41:5: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^