1 solutions
-
0
C :
#include<stdio.h> int main() { int i, j, n, a, b, s; scanf("%d", &n); while(n--) { scanf("%d%d", &a, &b); s = 1; for(i=0; i<b; i++) { s = (a%1000 * s)%1000; } printf("%d\n", s); } return 0; }C++ :
#include <cstdio> #include <cstring> #include <cmath> using namespace std ; int num[10000] ; int abs( int a ) { if( a < 0 ) return -a ; return a ; } int main() { int n ; scanf("%d" ,&n ) ; while( n -- ) { int a , b ; scanf("%d%d" , &a , &b ) ; int res = 1 ; for( int i = 0 ; i < b ; i ++ ) { res = ( res * a ) % 1000 ; } printf("%d\n" , res ) ; } return 0 ; }
- 1
Information
- ID
- 20201
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By