TOPIC
PROBLEM 1848 - URI Fórum 1.0
This topic was solved and cannot recieve new replies.
-
Sebastião Ricardo Costa Rodrigues replied 4 years ago
Já fiz tudo o que se possa imaginar... O meu código fornece exatamente as mesmas saídas que o toolkit e só recebo WA 90% nas submissões...
-
Lucas Rocha dos Santos replied 5 years ago
Lembrem-se que não há só as combinações que o problema dá nos exemplos, existem outras... A entrada pode ser: "caw caw" "--" - 1 "--" - 2 "-" - 3 "--" - 4 "-*" - 5 "*-" - 6 "" - 7 Na dúvida, basta tentarem estas no toolkit e verão que existem...
-
Michael Monteiro replied 4 years ago
Está dando 30% WA, alguém pode me ajudar?
#include <stdio.h> #include <string.h> int binario_decimal(char bin[]); int main() { int i=0,j; char codigo[10],soma=0; while(i<3) { scanf("%[^\n]s",codigo); getchar(); if(strcmp(codigo,"caw caw")==0) { printf("%d\n",soma); soma=0; i++; } else soma+=binario_decimal(codigo); } return 0; } int binario_decimal(char bin[4]) { if(strcmp(bin,"---")==0) return 0; if(strcmp(bin,"--*")==0) return 1; if(strcmp(bin,"-*-")==0) return 2; if(strcmp(bin,"-**")==0) return 3; if(strcmp(bin,"*--")==0) return 4; if(strcmp(bin,"*-*")==0) return 5; if(strcmp(bin,"**-")==0) return 6; if(strcmp(bin,"***")==0) return 7; }
-
Divani Barbosa replied 5 years ago
Obrigada pela dica, não tinha entendido o texto, bem confuso!!! Tenho mais dificuldade em entender o texto que montar o programa!!!
-
Guilherme Alexandre replied 4 years ago
ALGEUM PODE ME AJUDAR ESTA DANDO RESULTADO CORRETO POREM NO TESTA DA WA 50 %
#include <stdio.h> #include <string.h> main() { int caw = 3,soma; char a[50]; while(caw > 0) { soma=0; do { gets(a); if(strcmp(a, "*--") == 0) soma=soma+4; else if(strcmp(a, "-*-") == 0) soma=soma+2; else if(strcmp(a, "--*") == 0) soma=soma+1; }while(strcmp(a, "caw caw") != 0); printf("%d\n", soma); caw--; } system("pause"); }
-
🧙The Install Wizard 🧙 replied 4 years ago
Tire o espaço na string "caw caw". Os casos de teste não colocam espaço depois da string =)
-
Felipe Fontenele (Fonte 🖥️🏃💨) replied 4 years ago
O meu código está dando Time Limit Exceeded, alguma sugestão?
#include<iostream> #include<string> using namespace std; int main() { string corvo; int cont=0,soma=0; while(cont<=3) { getline(cin,corvo); if(corvo=="caw caw ") { cont++; cout<<soma<<endl; soma=0; if(cont==3) { break; } } else { if(corvo=="--*") { soma+=1; } else { if(corvo=="*--") { soma+=4; } else { if(corvo=="-*-") { soma+=2; } else { if(corvo=="-**") { soma+=3; } else { if(corvo=="*-*") { soma+=5; } else { if(corvo=="**-") { soma+=6; } else { if(corvo=="***") { soma+=7; } } } } } } } } } return 0; }
-
Matheus Cunha Reis replied 5 years ago
Está dando 50% Wrong e está certo. Alguem me ajuda pelo amor de deus
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i, soma=0; char binario[25], frase[]="amor"; for (i = 0; i < 3; i++) { fflush(stdin); while(strcmp(binario, "caw caw\n") != 0) { fgets(binario, 25, stdin); if (strcmp(binario, "--*\n") == 0) soma = soma + 1; else if (strcmp(binario, "-*-\n") == 0) soma = soma + 2; else if (strcmp(binario, "*--\n") == 0) soma = soma + 4; if (strcmp(binario, "caw caw\n") == 0) printf("%d\n", soma); } strcpy(binario, frase); soma = 0; } return 0; }
-
Igor Quiterio replied 5 years ago
esperimentem jogar isso no toolkit: Sua Entrada
*-- caw caw *-- *-- caw caw *-- -*- caw caw
a resposta ta saindo assim: Saída Gerada
10 14 19
edit : o meu esta dando 50% tbm, mas eu não tratei para o caso retratado acima
-
Eduardo Garcia replied 5 years ago
string grito = "caw caw", cod1 = "--*", cod2 = "-*-", cod4 = "*--"; int cont = 3, soma = 0; while(cont > 0){ string ler = ""; getline(cin,ler); if(ler == cod1){ soma += 1; }else if(ler == cod2){ soma += 2; }else if(ler == cod4){ soma += 4; }else if(ler == grito){ cout << soma << endl; cont --; soma = 0; } }
WA 50%, alguma dica?
-
Unknown replied 5 years ago
WA 50% why
include includeusing namespace std; int main() { string a; int k=0,s=0; while(1){ cin>>a; if(a=="caw" ){k++; if(k==6){cout<<s<<'\n';break;} if(k%2==0){ cout<<s<<'\n'; s=0; }} else if(a=="--")s+=4; else if(a=="--")s++; } }
-
Unknown replied 5 years ago
O problema diz q a saída contém três linhas, e o toolkit imprimi mil linhas. Meu programa printa três linha conforme os casos de teste e está dando 50%, agora não sei se o certo é a descrição do problema ou o toolkit..
-
🧙The Install Wizard 🧙 replied 5 years ago
Mateus. Veja se o tamanho do seu vetor é suficiente para armazenar as strings que estão sendo lidas.
-
Mateus Azevedo Felix de OLiveira replied 5 years ago
Gostaria de saber qual o problema neste código. Recebo apenas Runtime Error, porem com todas saídas certas, conforme o exercício pede. Agradecido.
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { int cont = 1, num = 0 ; char cv[4]; char cmp[8]="caw caw"; while(cont<=3){ gets(cv); if(strcmp(cv,cmp)!=0){ if(cv[0]==42){ num = num + 4; } if(cv[1]==42){ num = num + 2; } if(cv[2]==42){ num = num + 1; } } else{ printf("%d\n",num); num = 0; cont++; } } return 0; }
-
Hades replied 5 years ago
Caros,
Os problemas novos do URI estão bem confusos! Estou com WS de 50% e não sei a razão.
Vamos a dúvida: O programa resume-se a encontrado um caw caw retornar a soma corrente dos valores, correto? Eu implementei isso e não passa.
Usando o toolkit com a seguinte entrada (ela é grande!! :) ) A resposta bate com meu código. Alguém tem um caso de teste diferente para eu testar???
Segue a entrada:
--* caw caw *-- caw caw caw caw --* --* --* caw caw *-- *-- caw caw --* *-- caw caw caw caw caw caw caw caw *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- *-- caw caw caw caw caw caw Saída: 1 4 0 3 8 5 0 0 0 1000 0 0
-
joão carlos gonçalves replied 5 years ago
Gente estou tendo dificuldades com este problema. Alguém pode ajudar?
while(true) { gets(corvo); if(strcmp(corvo, "caw caw")==0) { pios++; if(pios==3) { printf("%d\n", soma); break; } else printf("%d\n", soma); soma = 0; } else { if(corvo[2]=='*') soma += 1; if(corvo[1]=='*') soma += 2; else soma += 4; } }