本文主要是介绍ACM从零开始---电子科大POJ 整数的千位分隔,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
整数的千位分隔
Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)
C-sources:
#include<stdio.h>
int main()
{int number;unsigned int ThreeBefore,ThreeAfter;printf("Please input the value of number:\n");scanf("%d",&number);unsigned int *in=NULL;in=(int*)malloc(number*sizeof(int));int i;for(i=0;i<number;i++){scanf("%u",&in[i]);}for(i=0;i<number;i++){if(in[i]<=999)printf("%u\n",in[i]);else{ThreeBefore=in[i]/1000;ThreeAfter=in[i]%1000;printf("%u,%u\n",ThreeBefore,ThreeAfter);}}return 0;
}
这篇关于ACM从零开始---电子科大POJ 整数的千位分隔的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!