摘要:
#include<stdio.h>int findline(int n) { for(int i = 1;;i++) { if(i*(i-1)/2 >= n) { return i-1; } } }int main() { int n,temp,line,rever; scanf("%d",&n); line = findline(n); if(line%2 == 0) { temp = n - line*(line-1)/2; rever = line - temp + 1; } else if(line%2 == 1) { rever = n 阅读全文
随笔档案-2013年2月6日
5.3.2 字母重排
2013-02-06 10:42 by Dr.Ray, 151 阅读, 收藏,
摘要:
1、qsort 函数qsort(void *base, int num, int width, int order)base :待排序的指针num : 指针中元素的个数width :元素的长度order :一般用函数表示,如果排char的顺序,则int cmp_char(const void *a, const void *b){ return *(char*)a - *(char*)b;}再调用qsort(word, strlen(word), sizeof(word), cmp_char)即可将word排序。注意cmp_char不用加参数。2、strcpy(char *a, const c 阅读全文
浙公网安备 33010602011771号