제출 #19507

#제출 시각아이디문제언어결과실행 시간메모리
19507sung927Α (kriii4_P1)C++98
컴파일 에러
0 ms0 KiB
#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); for( int i=1; ;i<=max+1; i++) {if(Tr[i]) ans*= arr[i]; if(ans>1000000007) ans%=1000000007;} printf("%lld", ans); }

컴파일 시 표준 에러 (stderr) 메시지

P1.cpp: In function ‘int main()’:
P1.cpp:38:21: warning: for increment expression has no effect [-Wunused-value]
     for( int i=1; ;i<=max+1; i++) {if(Tr[i]) ans*= arr[i]; if(ans>1000000007) ans%=1000000007;}
                     ^
P1.cpp:38:28: error: expected ‘)’ before ‘;’ token
     for( int i=1; ;i<=max+1; i++) {if(Tr[i]) ans*= arr[i]; if(ans>1000000007) ans%=1000000007;}
                            ^
P1.cpp:38:30: error: name lookup of ‘i’ changed for ISO ‘for’ scoping [-fpermissive]
     for( int i=1; ;i<=max+1; i++) {if(Tr[i]) ans*= arr[i]; if(ans>1000000007) ans%=1000000007;}
                              ^
P1.cpp:38:30: note: (if you use ‘-fpermissive’ G++ will accept your code)
P1.cpp:38:33: error: expected ‘;’ before ‘)’ token
     for( int i=1; ;i<=max+1; i++) {if(Tr[i]) ans*= arr[i]; if(ans>1000000007) ans%=1000000007;}
                                 ^
P1.cpp:31:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &A);
                      ^
P1.cpp:32:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &X);
                      ^