Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define gc c=getchar()
- #define r(x) read(x)
- #define ll long long
- template<typename T>
- inline void read(T&x){
- x=0;T k=1;char gc;
- while(!isdigit(c)){if(c=='-')k=-1;gc;}
- while(isdigit(c)){x=x*10+c-'0';gc;}x*=k;
- }
- int main(){
- int T;r(T);
- while(T--){
- int p;r(p);
- for(int i=0;i<p;++i,puts("")){
- for(int j=0;j<p;++j){
- printf("%d ",(i+j)%p);
- }
- }
- for(int i=0;i<p;++i,puts("")){
- for(int j=0;j<p;++j){
- printf("%d ",(i*j)%p);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement