3054 High-precision exercise-File operations

Source: Internet
Author: User

3054 High-precision exercise-File operations

time limit: 1 sspace limit: 64000 KBtitle level: Diamonds Diamond SolvingView Run ResultsTitle Description Description

Input a set of data, add 1 after each data output

Enter a description Input Description

Input data: Two lines, first behavior one number n, second behavior n data

Output description Output Description

Output data: One row, for processed data

Sample input Sample Input

5

-1 2 100-5 14

Sample output Sample Output

0 3 101-4 15

Data range and Tips Data Size & Hint

Data range: 60% for data, ni≤32767

100% for data, ni≤10255

n<=500

The data was changed 7 times and finally changed.

Category labels Tags Click here to expand
#include <cstdio>#include<iostream>#include<cstring>#defineRef (I,X,Y) for (int i=x;i<=y;i++)#definedef (i,x,y) for (int i=x;i>=y;i--)using namespacestd;intlena,lenb,lenc,p,t,a[1010],b[1010],c[1010];Chara1[1010];BOOLflag=0;intMain () {scanf ("%d",&t);  while(t--) {memset (A1,0,sizeofA1); Memset (A,0,sizeofa); memset (b,0,sizeofb); Memset (c,0,sizeofc); scanf ("%s", A1); Lena=strlen (A1); lenb=1; Lenc=max (LENA,LENB); b[1]=1; if(a1[0]=='-'&&a1[1]=='1'&&a1[2]==' /') {printf ("0");Continue;} if(a1[0]=='-') {flag=1; def (I,lena-1,1) a[++p]=a1[i]- -; Lena--;p =0; }    Else       refI0, lena-1) a[lena-i]=a1[i]- -; if(!flag) {       refI1, Lenc) {C[i]+=a[i]+B[i]; C[i+1]+=c[i]/Ten; C[i]%=Ten; }       intj=lenc+1;  while(c[j]==0&&j>1) j--; Def (I,j,1) printf ("%d", C[i]); printf (" "); }    Else{printf ("-"); flag=0; refI1, Lena) {            if(a[i]<B[i]) {A[i+1]--;a[i]+=Ten; } C[i]=a[i]-B[i]; }        intj=lena+1;  while(c[j]==0&&j>1) j--; Def (I,j,1) printf ("%d", C[i]); printf (" "); }    }    return 0;}

3054 High-precision exercise-File operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.