Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- unsigned int num[100009];
- int main()
- {
- unsigned int n,i,j,k,x,y,z,cn,cnt=0;
- while(1){
- cnt++;
- scanf("%u",&n);
- if(n==0)
- break;
- for(i=0;i<n;i++)
- scanf("%u",&num[i]);
- num[n]=0;
- printf("Case %u:\n",cnt);
- for(i=0;i<n;i++){
- if(num[i]+1 != num[i+1])
- printf("0%u\n",num[i]);
- else
- {
- printf("0%u-",num[i]);
- j=i+1;
- while(1){
- if(num[j]+1 != num[j+1])
- break;
- j++;
- }
- x=num[i];
- y=num[j];
- cn=10;
- while(x-(x%cn) != y-(y%cn))
- cn=cn*10;
- z=num[j]%cn;
- printf("%u\n",z);
- i = j;
- }
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement