Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Help! presentation errorC code: /* ============================================================================ Name : poj1007.c Author : Cherles Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio.h> #include <stdlib.h> #define MAX_NUM 1000 #define MAXLENGHT 100 int main(void) { int i, j, k, number = 0, len = 0; char input[MAX_NUM][MAXLENGHT]; int value[MAX_NUM]; scanf("%d%d", &len, &number); for (i = 0; i < number; i++) { for (j = 0; j <= len; j++) { input[i][j] = getchar(); value[i] = 0; } } for (i = 0; i < number; i++) { for (j = 0; j <= len - 1; j++) { for (k = j + 1; k <= len; k++) { if (input[i][j] > input[i][k]) { value[i]++; } } } } for (i = 0; i < number; i++) { for (j = i + 1; j < number; j++) { if (value[i] > value[j]) { int temp = 0; char tempstr[MAXLENGHT]; temp = value[i]; value[i] = value[j]; value[j] = temp; for (k = 0; k <=len; k++) { tempstr[k] = input[i][k]; input[i][k] = input[j][k]; input[j][k] = tempstr[k]; } } } } for (i = 0; i < number; i++) { for (j = 0; j <= len; j++) { putchar(input[i][j]); } } return EXIT_SUCCESS; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator