# 13559 - Bingo rotation >author: Utin ###### tags: `array` --- ## Brief See the code below ## Solution 0 ```c= #include<stdio.h> int main() { int n, s[101][101], ans[101][101], a; scanf("%d", &n); for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { scanf("%d", &s[i][j]); } } scanf("%d", &a); //旋轉次數 a /= 90; //旋轉 for(int t=0; t<a; t++) { for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { ans[n-1-j][i] = s[i][j]; } } for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { s[i][j] = ans[i][j]; } } } //輸出 for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { printf("%d", s[i][j]); if(j != n-1) printf(" "); } printf("\n"); } } // By Utin ``` ## Reference
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up