1585 - Score

All about problems in Volume 15. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
Kenpachi24
New poster
Posts: 20
Joined: Wed Oct 30, 2013 7:06 pm

1585 - Score

Post by Kenpachi24 »

Some TEST CASE where my code not function .......... I have WA

Code: Select all

AC
Last edited by Kenpachi24 on Wed Jan 29, 2014 1:31 am, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 1585 - Score

Post by brianfry713 »

Change line 15 to:
String linea=br.readLine().trim();
Check input and AC output for thousands of problems on uDebug!
Kenpachi24
New poster
Posts: 20
Joined: Wed Oct 30, 2013 7:06 pm

Re: 1585 - Score

Post by Kenpachi24 »

Thank you; I think I'll use much this method
fireflies
New poster
Posts: 1
Joined: Wed Apr 22, 2015 9:32 am

1585-score

Post by fireflies »

keep getting WA on this one. whats wrong??

Code: Select all

#include<iostream>
#include<cstring>
using namespace std;

int main()
{
    int i,ans,T,j;
    string s;
    cin>>T;

for(j=0;j<T;j++)
  {
    int c=0,sum=0;
    cin>>s;
      
   for(i=0;i<s.size();i++)
    {
        if(s[i]=='o')
          s[i]=1;
        if(s[i]=='x')
            s[i]=0;
    }

for(i=0;i<s.size();i++)
{
    if(s[i]==0)
    {
        c=0;
    }
    
    if(s[i]==1)
    {
        c++;
    }
    sum=sum+c;
}
cout<<sum<<endl;
  }
}
Last edited by brianfry713 on Fri Jun 19, 2015 6:41 am, edited 1 time in total.
Reason: Added code blocks
cemsq
New poster
Posts: 1
Joined: Tue Oct 27, 2015 10:34 pm

Re: 1585 - Score

Post by cemsq »

can anyone help me?

I get RuntimeError and no more information with this code:

Code: Select all

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Score {

    public static void main(String ...args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        int count = 0;
        int total = 0;
        int N = Integer.parseInt(in.readLine().trim());
        while (N > 0) {
            char c = (char)in.read();
            if (c == '\n') {
                System.out.println(total);
                count = 0;
                total = 0;
                N--;
            } else {
                c = Character.toLowerCase(c);
                if (c == 'o') {
                    count++;
                    total += count;
                } else {
                    count = 0;
                }
            }
        }
    }
}
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 1585 - Score

Post by brianfry713 »

Use class Main
Check input and AC output for thousands of problems on uDebug!
Post Reply

Return to “Volume 15 (1500-1599)”