Cod sursa(job #998001)
| Utilizator | Data | 15 septembrie 2013 14:19:21 | |
|---|---|---|---|
| Problema | Farfurii | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <cstdio>
using namespace std;
int N, K, Left, Right;
int main()
{
freopen("farfurii.in", "r", stdin);
freopen("farfurii.out", "w", stdout);
scanf("%i %i", &N, &K);
Left = 1, Right = N;
for(int i = 1; i <= N; ++ i)
if(N - i <= K)
{
printf("%i ", Right);
Right --;
K -= N - i;
}else
{
printf("%i ", Left);
Left ++;
}
return 0;
}
