Show all threads Hide all threads Show all messages Hide all messages |
Я не понимаю что надо сделать? | eremeev.me.2012@gmail.com | 1336. Problem of Ben Betsalel | 8 Mar 2024 18:54 | 1 |
Что означает отношения квадрата и куба и что за число n |
WHY WA#12 | name | 1336. Problem of Ben Betsalel | 11 Jul 2023 22:48 | 3 |
[code deleted] Edited by moderator 27.07.2023 17:22 I know that 12th test is so big. Maybe it will help you Edited by author 19.09.2012 02:57 the solution in C++ gave WA12, but the same algorithm in Python gave AC. I think, overflow is comming. |
be aware of '\n' in the end | Ioann [Samara U] | 1336. Problem of Ben Betsalel | 15 Feb 2022 20:13 | 1 |
|
accepted | Mikhail | 1336. Problem of Ben Betsalel | 12 May 2018 20:57 | 1 |
//#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("avx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; using namespace std;
#define re return #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define sqrt(x) sqrt(abs(x)) #define mp make_pair #define pi (3.14159265358979323846264338327950288419716939937510) #define fo(i, n) for(int i = 0; i < n; ++i) #define ro(i, n) for(int i = n - 1; i >= 0; --i) #define unique(v) v.resize(unique(all(v)) - v.begin())
template <class T> T abs (T x) { re x > 0 ? x : -x; } template <class T> T sqr (T x) { re x * x; } template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; } template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }
typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<string> vs; typedef double D; typedef long double ld; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef unsigned long long ull; typedef tree <pair<int, char>, null_type, less<pair<int, char>>, rb_tree_tag, tree_order_statistics_node_update> _tree; map <int, int> m; void get (int x) { for (int i = 2, end = sqrt(x) + 1; i <= end; ++i) { if (x % i == 0) { m[i]++; x /= i; if (x > 1) get(x); re; } } if (x > 1) m[x]++; } int main() { ull n, _m = 1, k = 1; cin >> n; if (n == 1) { cout << "1\n1\n"; re 0; } get(n); for (auto j : m) { //cout << j.fi << ' '<< j.se << endl; if (j.se & 1) { k *= j.fi; j.se += 3; } j.se /= 2; fo(i, j.se) _m *= j.fi; } cout << _m << '\n' << k << endl; re 0; } |
It's very easy problem | ZamNick | 1336. Problem of Ben Betsalel | 28 Mar 2018 04:43 | 6 |
It's very easy problem, but many people don't understand how to solve it ... :) 7 lines : #include <iostream> using namespace std; int main(){ unsigned long long N; cin >> N; cout << N*N << endl << N; return 0; } 5 lines: #include <iostream> void main() { unsigned long long N; std::cin >> N; std::cout << N*N << std::endl << N; } 4 lines: public class solver { public static void main(String[] args) { long n = new java.util.Scanner(System.in).nextInt(); System.out.println(n*n + "\n"+n);}} var n:int64; begin read(n); writeln(n*n); write(n) end. Edited by author 06.10.2014 22:49 OMG, i made prime factorization of n, searching for odd powers, multiplying to get k got AC, but now I see it was not neccassary Also for 18 i got 12 and 2, as in example. Edited by author 27.11.2015 02:00 1 line, no ";" tricks to put multiple lines into one :) print (lambda x : str(int(x) * int(x)) + '\n' + x)(raw_input()) |
test 11 ......sad.... | xinxin | 1336. Problem of Ben Betsalel | 7 Oct 2016 20:06 | 1 |
#include<iostream> #include<stdlib.h> #include<math.h> using namespace std; int main() {long double n; long long int m,i; cin>>m;
for(i=1;i<10000000000000000000;i++) { n=sqrt(i*i*i*m); if(n==floor(n+0.5)) { cout<<n<<endl<<i;break;} } fflush(stdin); getchar(); return 0;} |
test 11 ......sad.... | xinxin | 1336. Problem of Ben Betsalel | 7 Oct 2016 20:04 | 1 |
#include<iostream> using namespace std; int main() { double n; long long int m,i; cin>>m;
for(i=1;i<10000000000000000000;i++) { n=sqrt(i*i*i*m); if(n==floor(n+0.5)) { cout<<n<<endl<<i; break; } } fflush(stdin); getchar(); return 0; } |
gcc vs ms vc | ssau_nazarov_yuriy_pavlovich | 1336. Problem of Ben Betsalel | 12 Jul 2013 19:50 | 2 |
#include <stdio.h> int main(){ long long int t; scanf("%lld", &t); printf("%lld\n%lld", t*t, t); return 0; } AC with MS VC, but WA 1 with GCC. Can anybody explain me what's wrong with my code? u should use %i64d instead %lld with GCC ;) Edited by author 12.07.2013 19:50 |
it is'nt problem ! | Mattiev Jamol | 1336. Problem of Ben Betsalel | 2 Jul 2013 16:58 | 1 |
you must print n^2 and n. |
WTF ? | =NeRRouZ= | 1336. Problem of Ben Betsalel | 9 Oct 2011 12:43 | 2 |
WTF ? =NeRRouZ= 21 Apr 2011 20:52 Why n = 18; m = 12, k = 2; When n = 18; m = 324, k = 18; Edited by author 21.04.2011 20:52 Re: WTF ? Tyo Dmitry [Tomsk PU] 9 Oct 2011 12:43 Why do you think, that there is the only solution? |
Too easy | Dan Manastireanu | 1336. Problem of Ben Betsalel | 27 Aug 2010 02:39 | 2 |
Too easy Dan Manastireanu 22 Feb 2009 21:48 The obvious solution is too simple. You should ask for the smallest numbers. That solution is also easy enough, so it shouldn't be a problem for most people. Anyway, maybe the purpose of this problem is to teach people to use __int64. In that case simpler is better :) Edited by author 22.02.2009 21:50 OMFG. :D At first I solved it with about 50 strings of code. But after AC I catcha the 5-strings solution. :D |
WA7 | tornike | 1336. Problem of Ben Betsalel | 8 Feb 2009 21:47 | 1 |
WA7 tornike 8 Feb 2009 21:47 |
Spaces in tests. Wrong tests? | Teacher30 | 1336. Problem of Ben Betsalel | 19 Jan 2009 03:09 | 2 |
"324 18" - wrong answer "324\n18" - accepted Judges, is it normal? |
For Java solution, you must use "long", not "int".. ;-) | AnyoneNeedingHelp | 1336. Problem of Ben Betsalel | 30 Nov 2008 04:17 | 1 |
And, it's all that I've to speak to you. ** sorry for my bad english.. :D |
I think the author forgot the conditition that it's necessary to find the smallest m and k, otherwise the problem looks very poor? | Protsenko Sergey[Ivanovo SPU] | 1336. Problem of Ben Betsalel | 24 Jul 2008 22:02 | 2 |
Edited by author 24.07.2008 22:05 |
i have problems with 12 test.What is wrong | Igor | 1336. Problem of Ben Betsalel | 24 Jul 2008 21:08 | 3 |
#include <iostream> #include <math.h> using namespace std; unsigned long long n,b,c,k,m; long double f,i; int main () { cin >>n; b=2; if (modf(sqrt((double)n),&i)==0) {cout <<(unsigned long long)sqrt((double)n)<<"\n"; cout <<"1"<<"\n";} else { for ( ;b<=n;b++) { f=modfl(sqrt((long double)n*(double)(b*b*b)),&i); if (f==0) break; } m=(unsigned long long )sqrt((long double)n*(double)(b*b*b)); cout <<m<<"\n"; cout <<b<<"\n"; } return 0; } I had WA12 when I wrote v*v for integer v - it overflowed. Perhaps your long double (equals double for VC++) overflows too. Try putting everything into __int64, no floating point. I use prime factorization for that. |
it is very very very easy | Ferman | 1336. Problem of Ben Betsalel | 24 Jul 2008 21:07 | 2 |
you can write any numbers which can answer the condition but didn't smallest smallest are also easy :) |
it is very very very easy | Ferman | 1336. Problem of Ben Betsalel | 12 Jan 2008 01:06 | 1 |
|
why get 'ac' used ""pascl"" ?but.... | lian lian | 1336. Problem of Ben Betsalel | 3 Jan 2008 18:27 | 3 |
why get 'ac' used ""pascl"" var n:int64; begin readln(n); writeln(n*n); writeln(n); end. --------------------------------- but: #include<stdio.h> int main() { unsigned long long n; scanf("%lld",&n); printf("%lld\n",n*n); printf("%lld\n",n); return 0; } who could tell me when i use "c",get "wa"? i am confused;
read FAQ for long long you should use %I64d |
Why if to remove m=n*n and k=n. wrong answer??????/ | Виктор Крупко | 1336. Problem of Ben Betsalel | 23 Dec 2006 19:24 | 16 |
Probably you output it in one string? [code deleted] Edited by moderator 23.06.2006 17:18 I submited your program, it really have WA 12, but when I changed 'extended' to 'int64' it has got AC. Edited by author 01.04.2005 20:06 Edited by author 01.04.2005 20:06 I do not know such type 'int64'. How him to set? It's AC modification of your program. Here was AC solution :) Please, write me when you read I will delete it. Edited by author 02.04.2005 03:09 Thanks! Виктор Крупко 2 Apr 2005 00:20 but But, At me in pascal gives out a mistake (3)! Why? in tpx7 this type is not work. Try delphi or free pascal How to enter the data? How to deduce the data? You ask about using Delphi? or about using type int64 in it? New -> ... Console Application. I do not remember exactly, because I use c++, but I did so in past. Than you will to wright all like in TP7, but many features will be added. For exaple type int64. Sorry for poor English ;) Edited by author 02.04.2005 16:52 Got AC. Just use int64. Let m=n^2,k=n,then it's so easy.... Edited by author 17.06.2006 14:48 Can I see your AC program?I can't solve it. My email:charlie-wang-72@163.com |