UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#171357#994. 变换队形heyuzhen1000ms1208kbC++332b2023-06-22 21:55:082023-06-22 21:55:10

answer

#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
ll n,m,a[1005];
int main(){
	cin >> n >> m;
	for(ll i = 1;i <= n;i++)
		cin >> a[i];
	sort(a + 1,a + n + 1);
	reverse(a + 1,a + n + 1);
	for(ll i = 1;i <= n;i++){
		cout << a[i] << " ";
		if(i % m == 0)cout << "\n";
	}
	return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 33
Accepted
time: 0ms
memory: 1200kb

input:

10 2
137 173 167 137 147 153 177 155 177 177

output:

177 177 
177 173 
167 155 
153 147 
137 137 

result:

ok 5 lines

Test #2:

score: 33
Accepted
time: 0ms
memory: 1208kb

input:

64 4
172 105 171 146 194 153 108 115 176 164 131 108 135 192 154 139 165 162 187 138 102 175 106 128...

output:

199 198 197 194 
194 192 191 190 
189 187 186 181 
179 176 175 172 
172 171 167 165 
164 164 162 162...

result:

ok 16 lines

Test #3:

score: 33
Accepted
time: 0ms
memory: 1208kb

input:

54 6
102 195 123 137 151 108 130 104 110 175 125 153 176 159 149 173 165 170 107 154 188 131 159 120...

output:

196 195 189 188 188 187 
182 182 182 181 176 176 
175 175 173 172 172 170 
169 167 166 166 165 160 
...

result:

ok 9 lines