75,#1~#5

P1553 数字反转(升级版)

~~是不是答了楼主也看不到了(被封了。。。)~~
by AlexKun @ 2023-03-08 21:47:56


@[AlexKun](/user/926722) 能看到
by kevin3 @ 2023-03-08 21:48:41


@[kevin3](/user/735452) AC code: ```cpp #include<bits/stdc++.h> using namespace std; unsigned long long n,m; char c; unsigned long long _swap(unsigned long long s) { unsigned long long a=0; while(s) { a*=10; a+=s%10; s/=10; } return a; } signed main() { cin>>n>>c; switch(c) { case '.': cin>>m; cout<<_swap(n)<<c<<_swap(m); break; case '/': cin>>m; cout<<_swap(n)<<c<<_swap(m); break; case '%': cout<<_swap(n)<<c; break; default: cout<<_swap(n); break; } return 0; } ``` 本题需使用 unsigned long long,且结尾不保证有\n,思路来自[这个贴](https://www.luogu.com.cn/discuss/566231)。
by Silent_Ltcd_2024 @ 2023-03-08 22:04:55


|