

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
uses crt, math;
var i, x:longint;
n:qword;
function s(x:longint):word;
var res:word;
begin
res:=0;
while x <> 0 do
begin
inc(res, x mod 10);
x:=x div 10;
end;
exit(res);
end;
begin
clrscr;
readln(n);
x:=trunc(exp((1/3) * ln(n))) + 1;
for i:=max(x - 300, 0) to x do
if (i*i*i*s(i) = n) then
begin
write(i);
exit;
end;
write(-1);
readln;
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
![]()
#include <bits/stdc++.h>#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);#define int long long#define ff first#define ss second#define endl "\n"#define pii pair<int,int>#define debug(x) {cout<<"---> "<<#x<<" = "<<x<<endl;}#define TIME (clock() * 1.0 / CLOCKS_PER_SEC)#define _task "solve"
using namespace std;
bool SX(int Sx, int x){ int S = 0; while (x > 0){ S += x % 10; x /= 10; } return (S == Sx);}signed main(){ freopen(_task ".inp", "r", stdin); freopen(_task ".out", "w", stdout); faster; int n; cin >> n; for(int Sx = 1; Sx <= 90; Sx++){ int delta = Sx*Sx + 4*n; double d1 = sqrt(delta); int d2 = sqrt(delta); if (d1 == d2){ int x = (-Sx + d2); int _x_ = x / 2; if (x % 2 == 0 and SX(Sx, _x_)){ cout << _x_; exit(0); } } } cout << -1; return 0;}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin
3
851
3
Anh ơi giúp em làm bài này với ạ=(( https://hoidap247.com/cau-hoi/2749763
0
20
0
giúp mik code c++ vs bạn ơi