Show all threads Hide all threads Show all messages Hide all messages |
Page 3 |
Python 3 | tdnnojtupbkmuhehvb | 1243. Divorce of the Seven Dwarfs | 24 Aug 2021 11:19 | 2 |
Python 3 tdnnojtupbkmuhehvb 12 Apr 2021 14:40 |
be careful about "%" | Vlad | 1243. Divorce of the Seven Dwarfs | 29 Jun 2021 11:47 | 2 |
in python: -5 % 7 == 2 in c++: -5 % 7 == -5 |
AC one LINE | matvey22122 | 1243. Divorce of the Seven Dwarfs | 7 May 2020 20:05 | 1 |
|
So easy / phyton 3 solution | SMMaster | 1243. Divorce of the Seven Dwarfs | 15 Dec 2019 16:37 | 1 |
a = int(input()) c= a//7 d=c*7 print(a-d) |
Logic Explanation | Evans_DoN | 1243. Divorce of the Seven Dwarfs | 3 Nov 2019 18:18 | 1 |
I got my code running due to the solutions posted.. But i want to understand the logic behind the division.. Any one? |
WA test 5 please help me c++ | Abdullahil Baki Adol | 1243. Divorce of the Seven Dwarfs | 6 Aug 2019 22:37 | 1 |
#include<bits/stdc++.h> using namespace std; int main(){ unsigned long long int n; try{ cin >> n; cout << n%7 << endl; }catch(exception e){ cout << 1 << endl; } return 0; } |
5 test? c | Sanchir | 1243. Divorce of the Seven Dwarfs | 23 Feb 2019 17:10 | 1 |
#include <stdio.h> int main() { unsigned long long int a; scanf("%llu", &a); if (a/7!=0) printf("%llu\n", a%7); else if (a < 7) printf("%d\n", a); } |
признак делимости на 7 ;) | Mapu | 1243. Divorce of the Seven Dwarfs | 25 Jan 2019 02:16 | 1 |
|
почему код у меня работает а в тимусе на 1 тесте ошибка? | saharok | 1243. Divorce of the Seven Dwarfs | 27 Aug 2015 00:18 | 3 |
компилятор visual studio 2010 - 1wa c++11 -4wa c++14 -4wa КАК???!!! код #include <iostream> #include <string> using namespace std; int main() { long int a; cin >> a; if(a < 7){ cout << a; return 0; } if(a>=7) cout << a%7; } I think number's type long more. You don't used long long. |
Java's pretty suitable on this problem ;D | GastonFontenla | 1243. Divorce of the Seven Dwarfs | 24 Aug 2015 14:29 | 1 |
|
Page 2 |
Pascal's criterion | Kergan | 1243. Divorce of the Seven Dwarfs | 23 Jun 2015 11:20 | 1 |
Just use it to solve this problem. |
c# accepted | pav1uxa | 1243. Divorce of the Seven Dwarfs | 31 Dec 2014 16:46 | 1 |
del Edited by author 06.01.2015 21:37 |
why? 2 test | DioniS | 1243. Divorce of the Seven Dwarfs | 3 Dec 2014 15:54 | 1 |
var a:array[1..20] of integer; n,n1:string; x,k,i,s,code:integer; begin read(n); x:=length(n); k:=x div 3; if x mod 3>0 then k:=k+1; for i:=1 to k do begin n1:=copy(n,x-3*i+1,3); val(n1,k,code); a[i]:=k; delete(n,x-2*i,3); end; k:=x div 3; if x mod 3>0 then k:=k+1; if k div 2=0 then begin a[1]:=-1*a[1]; a[3]:=-1*a[3]; a[5]:=-1*a[5]; a[7]:=-1*a[7]; a[9]:=-1*a[9]; a[11]:=-1*a[11]; a[13]:=-1*a[13]; a[15]:=-1*a[15]; a[17]:=-1*a[17]; end else begin a[2]:=-1*a[2]; a[4]:=-1*a[4]; a[6]:=-1*a[6]; a[8]:=-1*a[8]; a[10]:=-1*a[10]; a[12]:=-1*a[12]; a[14]:=-1*a[14]; a[16]:=-1*a[16]; end; for i:=1 to 17 do s:=s+a[i]; write(abs(s mod 7)); end. |
Output limit exceeded | Faruk | 1243. Divorce of the Seven Dwarfs | 30 Nov 2014 19:46 | 1 |
what's that means? Output limit exceeded. |
Java Coders!!! | Evgeniy[VVV] | 1243. Divorce of the Seven Dwarfs | 1 Sep 2014 23:36 | 1 |
Dear Java Coders, you will solve this problem so easy, if you know what is BigInteger means. |
Help, I have a bug in the 5 test | PEDORENKO | 1243. Divorce of the Seven Dwarfs | 9 Aug 2015 03:18 | 2 |
#include <iostream> #include <math.h> using namespace std; int main(){ double x; int i; cin >> x; x = fmod (x, 7.0); printf("%.0f",x); system("pause"); return 0; } Edited by author 18.08.2014 21:49 it's ovbious that a number of 50 digits won't fit in a double. Such number wouldn't even fit in long long. You need other method... |
Accepted (Visual C++) | Vensus | 1243. Divorce of the Seven Dwarfs | 2 Nov 2015 00:01 | 3 |
#include <iostream> using namespace std; int main() { int k = 0; long long int s = 0; char num[52]; int arr[51]; bool flag = true; cin >> num; for(int i = 0; flag; i++) { switch(num[i]) { case '0': { arr[i] = 0; k++; break; } case '1': { arr[i] = 1; k++; break; } case '2': { arr[i] = 2; k++; break; } case '3': { arr[i] = 3; k++; break; } case '4': { arr[i] = 4; k++; break; } case '5': { arr[i] = 5; k++; break; } case '6': { arr[i] = 6; k++; break; } case '7': { arr[i] = 7; k++; break; } case '8': { arr[i] = 8; k++; break; } case '9': { arr[i] = 9; k++; break; } case '\0': { flag = false; break; } } } for(int i = k-1; i+1 > 6;) { s = s + arr[i]; s = s + arr[i-1]*3; s = s + arr[i-2]*2; s = s + arr[i-3]*6; s = s + arr[i-4]*4; s = s + arr[i-5]*5; i = i - 6; k = k - 6; } if(k > 0) { s = s + arr[k-1]; k--; } if(k > 0) { s = s + arr[k-1]*3; k--; } if(k > 0) { s = s + arr[k-1]*2; k--; } if(k > 0) { s = s + arr[k-1]*6; k--; } if(k > 0) { s = s + arr[k-1]*4; k--; } if(k > 0) { s = s + arr[k-1]*5; k--; } cout << s%7; return 0; } Edited by author 16.11.2013 14:57 Edited by author 16.11.2013 14:57 Thats all ;) char c,ans; main(){ for(;(c=getchar())!='\n';ans=(ans*10+c-'0')%7); printf("%u\n",ans);
return 0; } |
Can someone explain that? | kami_botanik | 1243. Divorce of the Seven Dwarfs | 5 Apr 2013 04:25 | 2 |
I don't understand what's the hint in this problem! I read it and I think this code must be enough to solve that problem in c#: using System; namespace ConsoleApplication1 { class Program1243 { static void Main() { ulong n = Convert.ToUInt64(Console.ReadLine()); Console.WriteLine(n%7);
} } } But I get WA#5. And I don't understand! Can someone help me? . . .
10^50 does not fit into UInt64. BigInteger integer does. However you could try to divide string by 7, or use some more sophiscated math (O(N), no divisions at all). |
Why Crash? | NiF | 1243. Divorce of the Seven Dwarfs | 27 Oct 2012 18:37 | 1 |
#include <iostream> #include <string> #include <stdlib.h> using namespace std; int main() { string s; char ss[10]; short l, i; int ostatok = 0, mnojitel = 1; cin >> s, ss; while (i < s.length() / 8) { l = s.copy(ss, 8, i*8); ss[9] = '\0'; ostatok = (ostatok * 100000000 + atoi(ss)) % 7; i++; } for (l = 0; l < s.length() - i*8; l++) mnojitel *= 10; l = s.copy(ss, s.length() - i*8, i*8); ss[s.length() - i*8] = '\0'; ostatok = (ostatok * mnojitel + atoi(ss)) % 7; cout << ostatok << endl; return 0; } It's work on my PC and give true results for input data from "Test Cases" |
Clearly, 0.015 is the new 0.001 | Bogatyr | 1243. Divorce of the Seven Dwarfs | 11 Oct 2012 15:37 | 3 |
It seems timing has changed since the earlier years on the server. When the following program gets WA in 0.015, you know 0.001 is not possible any more: #include <stdio.h> int main() { puts( "0" ); } Too bad that those of us solving problems now don't get time rated on the same scale as those who came before. But if your code work 0.5 now, in 2003 he worked more than 1 sec The fact that computers are faster today is not the point. In fact, it makes the 0.015 vs. 0.001 difference even more crazy -- computers today are *not* 15 times slower than in 2003! Obviously it is a difference in time measurement technique or a system difference that causes the measurements to differ. When such a measurement difference occurs, all problems should be re-rated for time, it's impossible to compete for time rating on O(1) problems when the fastest possible measurement today for an empty program is 15 times greater than it used to be. |