#include <stdio.h>
#include <string.h>
#define INPUT_LIMITS 50
#define INPUT_STR_LIMITS 10
void swap_int(int* a, int* b){
int tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
void swap_char_ptr(char** a, char** b){
char* tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
int main(void){
int i, j, inputed_num;
char shouhin[INPUT_LIMITS][INPUT_STR_LIMITS] = { { 0 } };
int kingaku[INPUT_LIMITS] = { 0 };
/* input data */
for(i
= 0; i
< INPUT_LIMITS
&& 2 == scanf("%s %d", shouhin
[i
], &kingaku
[i
]); i
++); /* この時iは入力したデータ数(1起算)になっている。配列は0から始まることに注意 */
inputed_num = i;
/* swap data */
for(j = 0, i -= 1; 0 != i && j < INPUT_LIMITS; ++i, --j){
swap_int(&kingaku[i], &kingaku[j]);
swap_char_ptr(&shouhin[i], &shouhin[j]);
}
/* print out result */
for(i = 0; i < INPUT_LIMITS && i < inputed_num; i++){
printf("%s %d\n", shouhin
[i
], kingaku
[i
]); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2RlZmluZSBJTlBVVF9MSU1JVFMgNTAKI2RlZmluZSBJTlBVVF9TVFJfTElNSVRTIDEwCnZvaWQgc3dhcF9pbnQoaW50KiBhLCBpbnQqIGIpewoJaW50IHRtcDsKCXRtcCA9ICphOwoJKmEgPSAqYjsKCSpiID0gdG1wOwp9CnZvaWQgc3dhcF9jaGFyX3B0cihjaGFyKiogYSwgY2hhcioqIGIpewoJY2hhciogdG1wOwoJdG1wID0gKmE7CgkqYSA9ICpiOwoJKmIgPSB0bXA7Cn0KaW50IG1haW4odm9pZCl7CglpbnQgaSwgaiwgaW5wdXRlZF9udW07CgljaGFyIHNob3VoaW5bSU5QVVRfTElNSVRTXVtJTlBVVF9TVFJfTElNSVRTXSA9IHsgeyAwIH0gfTsKCWludCBraW5nYWt1W0lOUFVUX0xJTUlUU10gPSB7IDAgfTsKCS8qIGlucHV0IGRhdG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