| Show all threads     Hide all threads     Show all messages     Hide all messages | 
| help (python) | quarylaniel | 2100. Wedding Dinner | 10 Sep 2023 19:31 | 2 | 
| n = int (input())cnt = 0
 for i in range (n+1) :
 a = input()
 if a[-4:] != "+one" :
 cnt += 1
 if a[-4:] == "+one" :
 cnt += 2
 if cnt != 11 :
 print ((cnt * 100) + 200)
 if cnt == 13 :
 print ((cnt * 100) + 300)
 
 Runtime error,what's wrong?
 
 Edited by author 02.03.2022 22:29
 | 
| Не понимаю в чем проблема. Пишет Runtime Error | Roman | 2100. Wedding Dinner | 14 Apr 2023 21:34 | 1 | 
| import java.util.Scanner;
 public class Task_2100 {
 public static void main(String[] args){
 Scanner scr1 = new Scanner(System.in);
 Scanner scr2 = new Scanner(System.in);
 
 int n, counter;
 n = scr1.nextInt();
 counter = n+2;
 while(n-- > 0){
 String guest = scr2.nextLine();
 String substring = "+";
 if(guest.contains(substring)){
 counter++;
 }
 }
 if(counter==13) {
 counter++;
 }
 System.out.print(counter*100);
 }
 }
 | 
| 05580 с++ | abram fedor | 2100. Wedding Dinner | 25 Mar 2022 06:13 | 1 | 
| #include <iostream>
 using namespace std;
 
 int main()
 {
 int n, x=2;
 cin>>n;
 x += n;
 while(n--)
 {
 string s;
 cin >> s;
 for(int i=0; i<s.size(); i++)
 {
 if(s[i]=='+')
 {
 x++;
 }
 }
 }
 if(x!=13)   cout << 100*x<< endl;
 else            cout << 100*(x+1) << endl;
 
 
 return 0;
 }
 
 Edited by author 25.03.2022 06:15
 
 Edited by author 25.03.2022 06:15
 | 
| c++ Accepted Simple Solution | Trest | 2100. Wedding Dinner | 1 Aug 2021 22:35 | 1 | 
| #include <iostream>#include <string>
 
 int main() {
 int n, gCount = 2;
 std::cin >> n;
 std::string guest;
 
 while (n--) {
 std::cin >> guest;
 gCount++;
 if (guest.find("+one", 0) != std::string::npos) gCount++;
 }
 if (gCount == 13) gCount++;
 std::cout << gCount * 100 << std::endl;
 
 return 0;
 }
 | 
| Simple Solution in C++ | Sofiullah Iqbal Kiron | 2100. Wedding Dinner | 5 Mar 2020 16:59 | 1 | 
| $ Before going to the solution, make sure that you had tried enough, please.
 $ Code:-
 
 #include<bits/stdc++.h>
 #define START int main(){
 #define END system("PAUSE");return 0;}
 using namespace std;
 
 START
 
 int n, guest=2;
 cin >> n;
 guest += n;
 while(n--)
 {
 string s;
 cin >> s;
 for(int i=0; i<s.size(); i++)
 {
 if(s[i]=='+')
 {
 guest++;
 }
 }
 }
 if(guest != 13)
 {
 cout << 100*guest << endl;
 }
 else
 {
 cout << 100*(guest+1) << endl;
 }
 
 END
 
 
 ///Thank You and Pray for me.
 
 Edited by author 05.03.2020 17:01
 | 
| C++ answer | gleb@il | 2100. Wedding Dinner | 26 Nov 2019 00:19 | 1 | 
| #include <iostream>#include <string>
 using namespace std;
 int main()
 {
 int n,g=2;
 cin >> n;
 for(int i = 0; i < n; i++)
 {
 string a;
 cin >> a;
 if(a.length() > 4 && a.substr(a.length()-4,a.length()-1) == "+one")
 g+=2;
 else
 g++;
 }
 if(g == 13)
 cout << 1400;
 else
 cout << g*100;
 }
 | 
| C answer | Rodrigo Munoz | 2100. Wedding Dinner | 3 Nov 2019 21:43 | 1 | 
| #include <stdio.h>#include <stdlib.h>
 #include <string.h>
 
 int main()
 {
 char name[20];
 int N;
 scanf("%d", &N);
 int cost=200;
 int $=0;
 for(int i=0; i<N; i++)
 {
 scanf("%s", name);
 if(name[strlen(name)-4]=='+'&&name[strlen(name)-3]=='o'&&name[strlen(name)-2]=='n'&&name[strlen(name)-1]=='e')
 {
 cost=cost+200;
 }
 else
 {
 cost=cost+100;
 }
 }
 $=$+cost;
 if($==1300)
 {
 $=$+100;
 }
 printf("%d", $);
 return 0;
 }
 | 
| getting runtime error in test case #3. Don't know why? Works fine in IDE | Ratnadeep Nandi | 2100. Wedding Dinner | 23 Jul 2019 22:34 | 2 | 
| a=int(raw_input())count=2
 for i in range(0,a):
 b=str(raw_input())
 if b[-4]=='+':
 count+=2
 else:
 count+=1
 if count==13:
 count+=1
 print(count*100)
solved!
 Since the problem says names consist of Latin letters (donno if + is used in Latin names), so string matching must include '+one' rather '+'
 
 so after correction of if b[-4]=='+': to if b[-4:]=='+one': it got accepted
 | 
| Python Solution. | Vladislav Ershov | 2100. Wedding Dinner | 19 Jul 2019 20:04 | 1 | 
| f = int(input())friends = []
 cnt  = 0
 for i in range(f):
 j = str(input())
 if j[-4:] == "+one":
 cnt += 200
 else:
 cnt+= 100
 if ((cnt/100)+2) == 13:
 cnt += 300
 else:
 cnt += 200
 
 print(cnt)
 
 I solve it by this
 | 
| Why wrong(C++) (incorrect input)? | Ilya | 2100. Wedding Dinner | 16 Jun 2019 18:07 | 1 | 
| #include <iostream>#include <string>
 using namespace std;
 int main()
 {
 int n,i,k=2;
 string s;
 cin>>n;
 
 for (i=1;i<=n;++i)
 {
 getline(cin,s);
 if (s.find("+")!=string::npos)
 k+=2;
 
 else
 ++k;
 }
 
 if (k==13)
 ++k;
 
 cout<<k*100;
 
 return 0;
 }
 
 Edited by author 16.06.2019 18:08
 
 Edited by author 16.06.2019 18:08
 | 
| В чем разница | Olegkyz | 2100. Wedding Dinner | 20 Feb 2019 13:01 | 1 | 
| Когда использую циклы такого вида выдает ошибку Runtime error (non-zero exit code)
 i=n;
 while(i>0) {
 name[i]=calloc(1,30);
 scanf(" %s",name[i]);
 i--;
 }
 i=n;
 while(i>0) {
 char *buf=name[i];
 while(*buf!='\0') {
 if(*buf=='+') {
 kol++;
 break;
 } else {
 buf++;
 }
 }
 i--;
 }
 
 А здесь AC
 for(i=0;i<n;i++) {
 name[i]=calloc(1,30);
 scanf(" %s",name[i]);
 }
 for(i=0;i<n;i++) {
 char *buf=name[i];
 while(*buf!='\0') {
 if(*buf=='+') {
 kol++;
 break;
 } else {
 buf++;
 }
 }
 }
 | 
| C# answer | Bro_EnotiKa | 2100. Wedding Dinner | 31 May 2018 19:02 | 1 | 
| using System;using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
 namespace ConsoleApp4
 {
 class Program
 {
 static void Main(string[] args)
 {
 int n = Convert.ToInt16(Console.ReadLine());
 int s = 2;
 for (int i = 1; i<=n; i++)
 {
 string a = Console.ReadLine();
 if (a.Contains("+one"))
 s += 2;
 else s++;
 }
 if (s == 13) s++;
 Console.WriteLine(s * 100);
 }
 }
 }
 | 
| What does it mean? | nick nikuradze | 2100. Wedding Dinner | 31 May 2017 23:04 | 4 | 
| What does it mean? Runtime error (access violation)This is my code on c++
 #include <iostream>
 using namespace std;
 int n,ans;
 string s;
 int main()
 {
 cin>>n;
 ans=n+2;
 for(int i=0; i<n; i++)
 {
 cin>>s;
 for(int j=0; j<s.size()-3; j++)
 {
 if(s[j]=='+' && s[j+1]=='o' && s[j+2]=='n' && s[j+3]=='e')
 {
 ans++;
 break;
 }
 }
 }
 if(ans==13) ans++;
 cout<<100*ans;
 return 0;
 }
 
 Edited by author 31.05.2017 21:40
for(int j=0; j<(int) s.size()-3; j++)
 
 Edited by author 31.05.2017 23:05
 
 Edited by author 31.05.2017 23:05
The problem is "s. size() -3".The type of s. size()  is SIZE_T.  It is UNSIGNED.  So,  if s. length <=2,then SIZE_T overflows.  The result is a HUGE number.  And j goes out of range.
"Access violation" means that you are trying to access some memory you are NOT SUPPOSED to access.
 Edited by author 31.05.2017 23:04
 | 
| Possible way to solve it (Python) | Mahilewets | 2100. Wedding Dinner | 14 May 2017 17:31 | 1 | 
| Set answer as (2+n).Then n times repeat answer+="+one"in set(input()).
 "+" in set(input ())  is also enough.
 | 
| Why correct code doesnt work? I get Runtime | SergeyGlazkov [SPbPU] | 2100. Wedding Dinner | 4 Mar 2017 00:23 | 1 | 
| Problem had tied on the fact that i used tokeniser for numbers and buffered reader for strings,Now i'm using bf reader for both strings and numbers and it gets AC.
 
 I leave it here, maybe it will useful
 
 Edited by author 05.03.2017 01:23
 |