写的有点复杂 本地的答案都正确 但是subtask0全wa 整疯了
查看原帖
写的有点复杂 本地的答案都正确 但是subtask0全wa 整疯了
896162
yihang_楼主2023/1/17 10:10
#include<iostream>//hang
#include<cmath>
#include<cctype>
using namespace std;
int y(int a) {//
   int sum = 0;
   if (a == 0) {
   	return sum;
   }
   for (; a > 0;sum++) {
   	a /= 10;
   }
}
void d(int a[],int s,int *p) {
   int x=0;
   for (int i = 0; i < s;i++) {
   	x = x * 10 + a[i];
   	//cout << x<<endl;
   }
   *p = x;
}
int a[100];
int main() {
 int zhi,i=0,u=0, j = 0,s;
 cin>> s;
 if (s == 0) {
     cout << s;
     return 0;
 }

 if (s < 0)
     cout << "-";
 s=abs(s);
 int p = y(s);
// cout << y(s);
 for (int i = 0; i <p; i++) {
     a[i] = s % 10;
     s /= 10;
     //cout << s<<endl;
}
 
   d(a, p, &zhi);
   cout << zhi;
   return 0;
} ```
2023/1/17 10:10
加载中...