13 条题解
-
3凌艺樽 (Lawrence劳伦斯) LV 10 @ 2023-9-16 19:07:00
#include <bits/stdc++.h> using namespace std; const int N=1e7+10; const int INF=0x3f3f3f3f; int a[N],n; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { for(int j=i;j<n+i;j++) { cout<<a[j]<<" "; } a[n+i]=a[i]; cout<<endl; } return 0; }
最简解法
-
12023-4-9 20:02:40@
#include <iostream> #include <stack> #include <cmath> #include <vector> #include <string.h> #include <queue> #include <stdio.h> #include <iomanip> #include <cstdio> #include <algorithm> #define int long long using namespace std; const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int a[N], n; signed main() { cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i]; } for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { int k = i + j; if(k <= n + 1) { cout << a[k - 1] << " "; } else if(k < n * 2) { cout << a[k % n - 1] << " "; } else { cout << a[n - 1] << " "; } } puts(""); } return 0; }
-
12023-2-2 15:01:46@
用坐标想
挺多坑的
#include <iostream> #include <stack> #include <cmath> #include <vector> #include <string.h> #include <queue> #include <stdio.h> #include <iomanip> #include <cstdio> #include <algorithm> #define int long long using namespace std; const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int a[N], n; signed main() { cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i]; } for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { int k = i + j; if(k <= n + 1) { cout << a[k - 1] << " "; } else if(k < n * 2) { cout << a[k % n - 1] << " "; } else { cout << a[n - 1] << " "; } } puts(""); } return 0; }
-
02024-11-10 18:38:57@
#include <bits/stdc++.h> int a[30000000],n; int main(){ std::cin>>n; for(int i=1;i<=n;i++) std::cin>>a[i]; for(int i=1;i<=n;i++){ for(int j=i;j<n+i;j++) std::cout<<a[j]<<" "; a[n+i]=a[i]; std::cout<<"\n"; } return 0; }//原创:dongliyang(深藏不露的c++高手)
-
02024-11-10 18:37:01@
```#include <bits/stdc++.h> using namespace std; const int N=1e7+10; const int INF=0x3f3f3f3f; int a[N],n; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { for(int j=i;j<n+i;j++) { cout<<a[j]<<" "; } a[n+i]=a[i]; cout<<endl; } return 0;```//就问这样不香吗(cc)?
-
02024-10-27 20:29:21@
#include <bits/stdc++.h>
using namespace std;
const int N=1e7+10;
const int INF=0x3f3f3f3f;
int a[N],n;
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int i=1;i<=n;i++)
{
for(int j=i;j<n+i;j++)
{
cout<<a[j]<<" ";
}
a[n+i]=a[i];
cout<<endl;
}
return 0;
}
-
02024-10-25 19:48:17@
#include <bits/stdc++.h> using namespace std; const int N=1e7+10; const int INF=0x3f3f3f3f; int a[N],n; int main() {cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { for(int j=i;j<n+i;j++) { cout<<a[j]<<" "; } a[n+i]=a[i]; cout<<endl; } return 0; }
-
02024-10-25 18:15:13@
#include <bits/stdc++.h> using namespace std; const int N=1e7+10; int a[N],n; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){ for(int j=i;j<n+i;j++){ cout<<a[j]<<" "; } a[n+i]=a[i]; cout<<endl; } return 0; }
-
02024-10-17 17:27:25@
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; int main(){ int b,a[N]; cin>>b; for(int i=1;i<=b;i++){ cin>>a[i]; } for(int i=1;i<=b;i++) { for(int j=i;j<b+i;j++) cout<<a[j]<<" "; a[b+i]=a[i]; cout<<endl; } return 0; }
-
02023-12-20 18:11:06@
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<vector> #include<stdlib.h> #include<queue> #include<map> #include<vector> #include<math.h> int m; int a[105]; using namespace std; int main(){ cin>>m; for(int i=1;i<=m;i++){ cin>>a[i]; } for(int i=1;i<=m;i++){ for(int j=i;j<=m+i-1;j++){ if(j>m)cout<<a[j-m]<<" "; else cout<<a[j]<<" "; } cout<<endl; } return 0; }
-
02023-12-20 18:10:45@
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<vector> #include<stdlib.h> #include<queue> #include<map> #include<vector> #include<math.h> int m; int a[105]; using namespace std; int main(){ cin>>m; for(int i=1;i<=m;i++){ cin>>a[i]; } for(int i=1;i<=m;i++){ for(int j=i;j<=m+i-1;j++){ if(j>m)cout<<a[j-m]<<" "; else cout<<a[j]<<" "; } cout<<endl; } return 0; }
-
02023-10-28 11:44:43@
#include <bits/stdc++.h> using namespace std; const int N=1e7+10; const int INF=0x3f3f3f3f; int a[N],n; int main() { return 0; }
-
-22021-10-19 21:49:51@
//模拟法——Sherlock
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
const int N=1e5+10;
int main()
{
int n,a[101],x=0;
cin>>n;
int sum=n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}//初始化
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++) { cout<<a[j]<<" "; }
cout<<endl;
x=a[1];//储存
for(int j=1;j<=n-1;j++) { a[j]=a[j+1]; }
a[n]=x;//数组后移
x=0;
}
return 0;
}
- 1
信息
- ID
- 1049
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 309
- 已通过
- 151
- 上传者