标签:hdu2550
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6498 Accepted Submission(s): 2450
1 4 3 4 4 5 5 6 6 7
>+-+> >+-+> >+-+> >+-+> >+--+> >+--+> >+--+> >+--+> >+--+> >+---+> >+---+> >+---+> >+---+> >+---+> >+---+> >+----+> >+----+> >+----+> >+----+> >+----+> >+----+> >+----+>
#include <stdio.h> #include <string.h> #include <algorithm> using std::sort; struct Node{ int a, b; } arr[52]; bool cmp(Node a, Node b) { return a.a < b.a; } int main() { int t, n, a, b, i, j; scanf("%d", &t); while(t--){ scanf("%d", &n); for(i = 0; i < n; ++i) scanf("%d%d", &arr[i].a, &arr[i].b); sort(arr, arr + n, cmp); for(i = 0; i < n; ++i){ while(arr[i].b--){ printf(">+"); for(j = 0; j < arr[i].a - 2; ++j) printf("-"); printf("+>\n"); } printf("\n"); } } return 0; }
标签:hdu2550
原文地址:http://blog.csdn.net/chang_mu/article/details/38311629