一直75分

P1553 数字反转(升级版)

```c #include<bits/stdc++.h> using namespace std; int main() { long long int a,a1=0,b,b1=0; char c; cin>>a; while(a!=0) { a1=a1*10+a%10; a/=10; } cout<<a1; if(c==10) return 0; cout<<c; if(c==37) return 0; cin>>b; while(b!=0) { b1=b1*10+b%10; b/=10; } cout<<b1; return 0; } ```
by 竹·寒 @ 2019-05-10 16:06:02


```cpp program P1553(input,output); var s:string; i,j,p:longint; flag:boolean; begin readln(s); if (pos('/',s)=0)and(pos('%',s)=0)and(pos('.',s)=0) then begin if (length(s)=1)and(s[1]='0') then begin writeln('0'); halt; end else begin for j:=length(s) downto 1 do if s[j]='0' then delete(s,j,1) else break; for i:=length(s) downto 1 do write(s[i]); halt; end; end; if pos('/',s)<>0 then//分数 begin p:=pos('/',s); for j:=p-1 downto 1 do if s[j]='0' then delete(s,j,1) else break; p:=pos('/',s); if p=1 then write('0') else for i:=p-1 downto 1 do write(s[i]); write('/'); for j:=length(s) downto p+1 do if s[j]='0' then delete(s,j,1) else break; for i:=length(s) downto p+1 do write(s[i]); halt; end; if pos('%',s)<>0 then//百分数 begin flag:=false; for i:=1 to length(s) do if (s[i]<>'0')or(s[i]<>'%') then flag:=true; if flag then begin for j:=length(s)-1 downto 1 do if s[j]='0' then delete(s,j,1) else break; if length(s)<>1 then begin for i:=length(s)-1 downto 1 do write(s[i]); end else write('0'); write('%'); halt; end else begin write('0%'); halt; end; end; if pos('.',s)<>0 then//小数 begin p:=pos('.',s); for j:=p-1 downto 1 do if s[j]='0' then delete(s,j,1) else break; p:=pos('.',s); if p=1 then write('0'); for i:=p-1 downto 1 do write(s[i]); write('.'); if (s[p+1]='0')and(p+2>length(s))then begin write('0');halt;end else begin j:=p+1; if (s[j]='0')and(s[j+1]<>'0') then delete(s,j,1) else begin for j:=p+1 to length(s) do if s[j]='0' then delete(s,j,1) else break; end; for i:=length(s) downto p+1 do write(s[i]); halt; end; end; end. ```
by jsxx_43 @ 2019-05-10 16:28:02


为什么我看不懂你写的什么???? 你可以对代码解释一下么??
by FoxSuzuran @ 2019-05-10 16:28:05


@[竹·寒](/space/show?uid=146276) 怎么感觉你没有考虑小数?
by ld_k_s @ 2019-05-10 16:30:11


@[我的主人](/space/show?uid=138265) 他们的语言不一样
by ld_k_s @ 2019-05-10 16:30:53


@[Sean0204](/space/show?uid=106795) 可能是,但我连点1都过不去
by 竹·寒 @ 2019-05-10 16:45:13


@[竹·寒](/space/show?uid=146276) 点1的内容是啥
by ld_k_s @ 2019-05-10 16:51:26


@[Sean0204](/space/show?uid=106795) 6980358432985
by 竹·寒 @ 2019-05-10 16:52:59


@[竹·寒](/space/show?uid=146276) 而且你没有考虑符号,如果测试店里有符号,就会错
by ld_k_s @ 2019-05-10 16:53:00


@[Sean0204](/space/show?uid=106795) 明白
by 竹·寒 @ 2019-05-10 16:56:38


| 下一页