Show all threads Hide all threads Show all messages Hide all messages |
why difficulty is 96? | Anton | 1644. A Whole Lot of Walnuts | 25 Jul 2021 17:22 | 1 |
I think it's easy problem and must be rated 30 |
why doesn't it work? java | Argin | 1644. A Whole Lot of Walnuts | 12 Mar 2020 20:58 | 3 |
import java.util.Scanner; public class javasucc { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int h = 2, s = 10; for(int i=0; i<n; i++) { int a = in.nextInt(); String b = in.next(); if(b=="hungry"){ if(a>h) {h = a;} } else if(b=="satisfied"){ if(a<s) {s = a;} } } if(h >= s) System.out.println("Inconsistent"); else System.out.println(s); } } and the problem is that program doesn't want to do if and i can't change s to a 1) I wasn't crying for help though but just was wondering why 2) Thanks for the link, the problem was actually in "==" |
AC C++ | D4nick | 1644. A Whole Lot of Walnuts | 9 Mar 2020 01:40 | 1 |
AC C++ D4nick 9 Mar 2020 01:40 #include <iostream> #include <string> using namespace std; int main() { int hun = 2, sat = 10, n; cin >> n; string s; for (int i = 0, num; i < n; i++) { cin >> num >> s; if (s == "hungry") if (num > hun) hun = num; if (s == "satisfied") if (num < sat) sat = num; } if (hun >= sat) cout << "Inconsistent"; else cout << sat; } |
WA 24!!!! WHAT'S WRONG????????????? | Maria | 1644. A Whole Lot of Walnuts | 19 Dec 2018 18:46 | 3 |
You are so awesome, that I want to become your girlfriend, pleeeeease marry me!!!!!!!!!!!!!! |
If u got WA #1 | ELDVN | 1644. A Whole Lot of Walnuts | 15 Nov 2015 02:48 | 1 |
Whos use => ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); => Need to delete, for the solve this problem. I think its a problem #CheckerMechanism |
Why WA1 with GoLang? | RemmargorP | 1644. A Whole Lot of Walnuts | 23 Jun 2015 16:37 | 1 |
[delete] Edited by author 23.06.2015 16:37 Edited by author 23.06.2015 16:37 |
My AC | TUITUF_Temurbek | 1644. A Whole Lot of Walnuts | 17 Jun 2015 13:14 | 2 |
My AC TUITUF_Temurbek 29 Aug 2013 12:41 import java.util.Scanner; public class T_1644 { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int n=sc.nextInt(); int min=10; int max=Integer.MIN_VALUE; for (int i = 0; i < n; i++) { int x=sc.nextInt(); String s=sc.next(); if(s.equals("hungry"))max=Math.max(x, max); else min=Math.min(min,x); } if(max<min) System.out.println(min); else System.out.println("Inconsistent"); } } |
java AC | esbybb | 1644. A Whole Lot of Walnuts | 16 Jun 2015 05:28 | 2 |
Messages should not contain correct solutions. i use 2 TreeSet<Integer>, nope, ok nope is prepopulated with 2, ok is prepopulated with 10 in cycle i read counts into one of them with checking if other one does not contain new value has been read recently if nope.last()>=ok.first() then the result is ok.first() nope.last>=ok.first ("g" instead of "ge" because they are never equal) |
Test 3 has been detected!!! | Alibi | 1644. A Whole Lot of Walnuts | 13 Jun 2015 01:36 | 2 |
|
Wa 8 | Zharenkov_ssau | 1644. A Whole Lot of Walnuts | 13 Jun 2015 01:34 | 4 |
Wa 8 Zharenkov_ssau 20 Jan 2009 14:17 var i,j,k,n,d,l:longint; st:string; s:array [1..100] of string; a:array [1..100] of integer; begin readln (n); if n=0 then writeln ('10'); k:=0; st:=''; for j:=1 to n do begin readln (k,st); a[j]:=k; s[j]:=st; end; for l:=1 to n-1 do for i:=1 to n-l do begin if a[i]<a[i+1] then begin k:=a[i]; a[i]:=a[i+1]; a[i+1]:=k; st:=s[i]; s[i]:=s[i+1]; s[i+1]:=st; end; end; i:=1; if s[1]=' satisfied' then begin while s[i]=' satisfied' do begin i:=i+1; k:=a[i-1]; end; writeln (k); end; d:=1; if s[1]=' hungry' then begin for i:=2 to n do begin if s[1]=s[i] then inc(d); end; if d= n then writeln ('10') else writeln ('Inconsistent'); end; end. can you give some tests? Edited by author 20.01.2009 14:17 try this: 2 5 hungry 5 satisfied (answer is "Inconsistent") Re: Wa 8 Ealham Al Musabbir 13 Jun 2015 01:34 |
HELP!!! WA14 | Alibi | 1644. A Whole Lot of Walnuts | 29 Dec 2014 15:47 | 1 |
|
WA #3, plz, help!!! | Masterpiece | 1644. A Whole Lot of Walnuts | 28 Apr 2014 17:20 | 4 |
People, can u help with test #3? I'm receiving WA... "It is known as a fact, that ten walnuts is always enough and two walnuts are always not enough." thanks!! that helped me!! I make the same mistake too. It is never too careful to read the question. |
Very easy problem!!!!!! | Enigma [UB of TUIT] | 1644. A Whole Lot of Walnuts | 23 Jan 2013 16:55 | 2 |
i agree you.can it done with 0.015s? i have 0.031
Edited by author 23.01.2013 16:55 Edited by author 23.01.2013 16:55 |
Handling Input | HappyPerson | 1644. A Whole Lot of Walnuts | 4 Nov 2012 09:41 | 2 |
Is there a way to just get the first character of the type of experiment? (Like, if it is "hungry" just receive the "h" and ignore the rest) Why can't you use string and only judge the string[0]? |
I give up ,WA#12 | Pegasus | 1644. A Whole Lot of Walnuts | 24 Sep 2012 21:58 | 3 |
#include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> ivec; vector<string> svec; int val; string s; for (int i = 0; i < n; ++i) { cin >> val; ivec.push_back(val); cin >> s; svec.push_back(s); } if (n == 0) { cout << 10 <<endl; return 0;} if (n == 1) { if (svec[0] == "satisfied") { cout << ivec[0] << endl; return 0;} if (svec[0] == "hungry") { cout << 10 << endl; return 0;} } int hungry[100]={0},satisfied[100]={0}; int hungry_num=0,satisfied_num=0; for (int i = 0; i < n; ++i) { if (svec[i] == "hungry") { hungry[hungry_num++] = ivec[i]; } if (svec[i] == "satisfied") { satisfied[satisfied_num++] = ivec[i]; } } sort(hungry, hungry+hungry_num); sort(satisfied, satisfied+satisfied_num); if (hungry[hungry_num-1] >= satisfied[0]) { cout << "Inconsistent" << endl; return 0; } cout << satisfied[0] << endl; return 0; } When n == 0; What is the answer? if n==0 answer is 10 Edited by author 24.09.2012 21:58 |
If n=1????? help!! | zsyzYYK | 1644. A Whole Lot of Walnuts | 23 Sep 2012 00:54 | 5 |
if you have only one experiments "X satisfied" then the answer is always X if you have only one experiments "X hungry" then the answer is always 10 If n == 0 ? What is the anwaer? Somebody already answered this in the discussion, it's 10 |
WA #3 | Tigran Apoyan (RAU) | 1644. A Whole Lot of Walnuts | 14 May 2012 00:31 | 1 |
WA #3 Tigran Apoyan (RAU) 14 May 2012 00:31 Edited by author 14.05.2012 00:31 |
Почему не проходит!!!! | Kvasela | 1644. A Whole Lot of Walnuts | 28 Apr 2012 18:38 | 2 |
#include <iostream> #include <string.h> using namespace std; void main() { int exp = 0; char fast[10]; int optimal = 0; int no_optimal = 0; int gorih; cin >> exp; for(int i = 1; i <= exp; i++) { cin >> gorih; cin>>fast; if(!strcmp(fast,"satisfied")) { if(optimal > gorih) { optimal = gorih;}if(optimal == 0){optimal=gorih;}} else {if(no_optimal==0){no_optimal=gorih;}if(no_optimal<gorih){no_optimal=gorih;}} } if(optimal == 0){cout<<"Inconsistent";} else if(optimal>no_optimal){ cout<<optimal;} else {cout<<"Inconsistent";} } It is known as a fact, that ten walnuts is always enough and two walnuts are always not enough. |
WA#15. I posted my C code | SpartakusMd | 1644. A Whole Lot of Walnuts | 15 Mar 2012 16:32 | 1 |
Hi. I've got WA on test 15. Here is my C code: /** * No: 1644 */ #include <stdio.h> #include <conio.h> #include <string.h> int main() { int n, i, a[101][2]={0}, maxs=0, mins=10, maxh=0; char s[15]; scanf("%d", &n); for(i=0; i<n; i++) { scanf("%d%s", &a[i][0], &s); if(strcmp(s, "satisfied") == 0) a[i][1] = 1; }
for(i=0; i<n; i++) if(a[i][1] == 1) { if(maxs < a[i][0]) maxs = a[i][0]; if(mins > a[i][0]) mins = a[i][0]; } else { if(maxh < a[i][0]) maxh = a[i][0]; }
if(maxs==0 && mins==10) printf("10"); else if(maxh >= maxs) printf("Inconsistent"); else { for(i=0; i<n; i++) if(a[i][0] > maxh && a[i][1] == 1 && maxs > a[i][0]) maxs = a[i][0]; printf("%d", maxs); }
return 0; } Edited by author 15.03.2012 16:34 |
Wa #1 | Apollon76 | 1644. A Whole Lot of Walnuts | 21 Jan 2012 21:55 | 1 |
Wa #1 Apollon76 21 Jan 2012 21:55 [deleted] Edited by author 22.01.2012 11:33 |