Show all threads Hide all threads Show all messages Hide all messages |
Hhelp | Respect1 | 1601. AntiCAPS | 29 May 2023 02:04 | 6 |
Hhelp Respect1 27 Dec 2012 14:56 Как понять когда она завершила ввод сообщения? Please use english. I translated your question with google translate and it said "How do you know when it has completed writing a message?". Well, it depends on the programming language you are using. Pascal: while not(eof(input)) (not sure if it was input) C: you usualy use while(!feof(stdin)) http://www.cplusplus.com/reference/cstdio/feof/ This doesn't seem to work (for me at least). C++: I think it's !cin.eof() (I've never used this one). > C: you usualy use while(!feof(stdin)) http://www.cplusplus.com/reference/cstdio/feof/> This doesn't seem to work (for me at least). This does not work if you read lines with gets and write it with puts, but feof(stdin) is works fine. May be some problems with linefeeds. Stupid MSVS. Edited by author 07.02.2013 12:20 Edited by author 07.02.2013 12:20Re: Hhelp [TDUweAI] daminus 26 Jun 2013 21:51 on pascal
while not eoln do begin read(g_string); ...... ...... end; on java: Scanner scan = new Scanner(System.in); while (scan.hasNext()){ s = scan.nextLine(); } on python message = sys.stdin.readlines() and then ctrl+D to stop input |
с#,4 и 21 тестs | Sergey | 1601. AntiCAPS | 5 Sep 2022 22:27 | 3 |
not 21 passes test: using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication3 { class Program { static void Main() { var f = Console.In.ReadToEnd(); f = f.ToLower(); var b = f.ToCharArray(); string c = ""; c += b[0].ToString().ToUpper(); for (var i = 1; i < b.Length - 3; i++) { if ((i + 1 != b.Length && (b[i] == '!' || b[i] == '?' || b[i] == '.'||b[i] == '-') && (b[i+3] != '-'&&b[i + 1] != '!' && b[i + 1] != '?' && b[i + 1] != '.')))
{ c += b[i]; i++; while (b[i] == ' ' || b[i] == '\t' || b[i] == '\r' || b[i] == '\n') { c += b[i]; if (i + 1 != b.Length) i++; else break; } c += b[i].ToString().ToUpper(); } else c += b[i]; } Console.WriteLine(c); } } } not 4 passes test: using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication3 { class Program { static void Main() { var f = Console.In.ReadToEnd(); f = f.ToLower(); var b = f.ToCharArray(); string c = ""; for (var i = 1; i < b.Length - 1; i++) { if (b[i - 1] == '-') i--; if ((i + 1 != b.Length && i + 2 != b.Length && i + 3 != b.Length && (b[i] == '!' || b[i] == '?' || b[i] == '.' || b[i] == '-') && (b[i + 3] != '-' && b[i + 1] != '!' && b[i + 1] != '?' && b[i + 1] != '.'))) {
c += b[i]; i++; while (b[i] == ' ' || b[i] == '\t' || b[i] == '\r' || b[i] == '\n') { c += b[i]; if (i + 1 != b.Length) i++; else break; } c += b[i].ToString().ToUpper(); } else { if (i == 1) c += b[i - 1].ToString().ToUpper(); c += b[i]; } } Console.WriteLine(c); } } } Edited by author 03.01.2015 21:08 - IS IT CORRECT? - YES, IT IS. - Is it correct? - Yes, it is. Мне этот пример помог 21 тест пройти If you have this problem - remember that a sentence is ended only with "!?." Endline is not an end of a sentence |
C# | Maxim Afripov | 1601. AntiCAPS | 2 Nov 2021 00:08 | 1 |
C# Maxim Afripov 2 Nov 2021 00:08 1) Input text 2) Compare each character with: letter punctuation 3) Output with changes using System; using System.Collections.Generic; namespace AntiCAPS { public class Program { public static void Main(string[] args) { bool _newSentence = true; string message = Console.In.ReadToEnd().ToLower(); List<char> punctuation = new List<char>(new char[] { '!', '.', '?' }); for (int iterable = 0; iterable < message.Length; iterable++) { if ((int)message[iterable] >= 97 && (int)message[iterable] <= 122) { if (_newSentence) { Console.Write(Char.ToUpper(message[iterable])); _newSentence = false; } else Console.Write(message[iterable]); } else if (punctuation.Contains(message[iterable])) { _newSentence = true; Console.Write(message[iterable]); } else Console.Write(message[iterable]); } } } } Edited by author 02.11.2021 00:10 |
how | Rodion | 1601. AntiCAPS | 13 Jul 2021 19:20 | 2 |
how Rodion 14 Sep 2020 22:33 как сделать ввод на питоне в этой задаче? how to make python input in this task? Re: how qumusabel 13 Jul 2021 19:20 |
Examples for test 9 | Student_MAT-MEX | 1601. AntiCAPS | 10 Mar 2021 15:06 | 5 |
Example 1: WHAT?????????????????????? Example 2: ?????????????????????? And... What is the answer? Example 1: WHAT?????????????????????? result: What?????????????????????? Example 2: ?????????????????????? result: ?????????????????????? These tests might cause runtime error if there're not all conditions observed in the code. Got AC just when passed these tests, thanks Try this: aaaaa...??? aaaa aaaaa.....!!! aa right answer: Aaaaa...??? Aaaa aaaaa.....!!! Aa "You are given Angela's message, which consists of uppercase English letters,..." -> Just uppercase letters in input. |
No subject | Alina_malina2008 | 1601. AntiCAPS | 25 Nov 2020 21:06 | 1 |
|
Acces Violation | Arseniy | 1601. AntiCAPS | 6 Jun 2020 19:34 | 1 |
Does anybody had Acces Violation? And if so , how did you fix it? |
Hints | Megatron | 1601. AntiCAPS | 3 Dec 2019 13:58 | 4 |
Hints Megatron 9 Mar 2009 19:36 If you wa, try these HELLO. WORLD - IS IT CORRECT? - YES, IT IS. thank you!This is test help me!!!))) I get AC! Re: Hints Tvildiani Daviti[Tbilisi SU] 1 Aug 2011 21:25 Thanks, My algo failed because of this case in test 2; |
Java 8: How to use both input and output? | Ionkin M [Samara SAU #617] | 1601. AntiCAPS | 15 Jul 2019 19:38 | 2 |
Sorry for my bad English. I use int ch; while ((ch = System.in.read()) != -1) { // my solution System.out.print(<some char>); } System.out.println(); But I get WA #1 with or without last code line. I also used System.out.flush (without last line), but it do not help me. Use Scanner from utils,that's better and esier , than use System.in.read() |
WA 21 | fufnir | 1601. AntiCAPS | 15 Feb 2019 18:50 | 1 |
WA 21 fufnir 15 Feb 2019 18:50 |
TEST#4 (attention) | junsuper | 1601. AntiCAPS | 28 Oct 2018 18:22 | 7 |
HHHHHH.KJDFDKJ(newline) ADFFG right answer
Hhhhhh.Kjdfdkj adffg I WA here for five times Edited by author 25.07.2008 08:43 Edited by author 25.07.2008 08:54 My program answers right on this, but still WA#4 Twenty times THANK YOU!!!! Edited by author 28.10.2018 18:23 Edited by author 28.10.2018 18:23 |
Best tests | zorggish | 1601. AntiCAPS | 30 Sep 2018 19:11 | 1 |
If you got WA, especially if you got WA9 First line is input string, second is answer TEST. TEST? TEST! TEST. Test. Test? Test! Test. ?????????????????????? ?????????????????????? !TEST!TEST! !Test!Test! A A TEST TEST TEST Test test test TEST T TEST Test t test Also try empty input. Edited by author 30.09.2018 19:14 |
Why WA#4 C++ | Burdin Artyom`~ | 1601. AntiCAPS | 16 Aug 2018 18:07 | 2 |
#include <bits/stdc++.h> using namespace std; int main() { string s; int pe = 0; while(getline(cin, s)) { for (int i = 0; i < s.length(); i++) { if (s[i] == '.' || s[i] == '!' || s[i] == '?' || (s[i] == '-' && i )) { pe = 0; } if ((s[i] - '0' + '0' >= 65 && s[i] - '0' + '0' <= 90) && pe != 0) { s[i] = s[i] - '0' + 32 + '0'; } if (pe == 0 && s[i] != ' ' && s[i] != '.' && s[i] != '!' && s[i] != '?' && s[i] != '-') { if (s[i] - '0' + '0' > 90) { s[i] = s[i] - '0' - 32 + '0'; } pe = 1; } } cout << s << '\n'; } } Edited by author 16.08.2018 18:05 Edited by author 16.08.2018 18:05 Ohhhhh..... I find my wrong... -HI - HI WA: -Hi - Hi AC: -Hi - hi |
Why WA 1#? | ananimus_vs16 | 1601. AntiCAPS | 3 May 2017 16:32 | 1 |
var s: array[1..50] of string; si, i1, i, c: integer; input, output: text; begin {$IFNDEF ONLINE_JUDGE} assign(input, 'input.txt'); reset(input); assign(output, 'output.txt'); rewrite(output); {$ENDIF} while not seekeof(input) do begin inc(si); read(input, s[si]); end; c := 1; for i := 1 to si do for i1 := 1 to length(s[i]) do begin if c = 0 then s[i][i1] := lowercase(s[i][i1]); if (c = 1) and (s[i][i1] <> ' ') and (s[i][i1] <> '-') and (s[i][i1] <> ':') then c := 0; if (s[i][i1] = '?') or (s[i][i1] = '.') or (s[i][i1] = '!') then c := 1; end;
for i := 1 to si do writeln(output, s[i]); {$IFNDEF ONLINE_JUDGE} close(input); close(output); {$ENDIF} end. |
Не работает не 1 тест. Хотя у меня работает все тест, которые были на форуме. Помогите, пожалуйста | Platt96 | 1601. AntiCAPS | 13 Jul 2016 15:15 | 3 |
#include<iostream> #include<conio.h> #include<string> using namespace std; char unCAPS(int state, char symbel) { char out_symb; if (((int)symbel >= 65 && (int)symbel <= 90) && state ==0) { out_symb = (char)(symbel + 32); return out_symb; }
if (((int)symbel >= 97 && (int)symbel <=122 ) && state == 1) { out_symb = (char)(symbel - 32); return out_symb; }
return symbel; } int main() { char str[10000] = { NULL }, str2[10000] = { NULL }; int state = 1; cin.get(str, 10000); for (size_t i = 0; i < strlen(str); i++) { str2[i] = unCAPS(state, str[i]); if ((int)str[i] != 32) { state = 0; } if ((int)str[i] == 46 || (int)str[i] == 33 || (int)str[i] == 63) { state = 1; }
} for (size_t i = 0; i < strlen(str2); i++) { cout << str2[i]; }
return 0; } Ты тестировал локально? Если нет, то попробуй. В http://acm.timus.ru/help.aspx?topic=cpp в самом конце указано, как пользоваться #ifndef ONLINE_JUDGE (на сервере этот код не выполнится, а у себя на компьютере тестировать удобно). И смотри, нет ли на выводе, например, лишних пробелов в конце или вроде того. You don't need conio.h You should use csting or string.h for strcpy. Did you really try to compile and run it? You shouldn't use ascii codes. "str[i] == '.'" is better then "(int)str[i] == 46". Why do you think that first non-space symbol in sentence is word? Why not "-"? You should read task carefuly. 2 lines in example is 1 test. You only process first line. |
Some test cases... | Mewtwo | 1601. AntiCAPS | 21 Jun 2016 23:57 | 1 |
I've been struggling hard to overcome WA4 and WA9... In the problem statement, it says "Sentences in a message consist of words, spaces and punctuation marks". Then I've made these test cases and got AC in one go... :) Try these cases if u get WA... Case 1: WHO ARE UUUUUUUUUUUUUUUUUUU UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU? CANT U SEE IT ? Ans: Who are uuuuuuuuuuuuuuuuuuu uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu? Cant u see it ? Case 2: WHO ARE UUUUUUUUUUUUUUUUUUU UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU? CANT U SEE IT ? Ans: Who are uuuuuuuuuuuuuuuuuuu uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu? Cant u see it ? (It looks same to case 1, but it has an initial space character in the first line and I think this was causing WA9 for me...) Case 3: AND BEING CARELESS, WE ARE DESTROYING THE EARTH. ????? WHO ARE UUUUUUUUUUUUUUUUUUU UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU? CANT U SEE IT ? WHY DID U DO THIS? UUUUUUUU UUUUUUUU IDIOT. BYE. Ans: And being careless, we are destroying the earth. ????? Who are uuuuuuuuuuuuuuuuuuu uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu? Cant u see it ? why did u do this? Uuuuuuuu uuuuuuuu idiot. Bye. Case 4: ...ARE U THERE STILL? PLEASE, ANSWER MEEEEEEEEE , ANSWER ME , ANSWER ME... PLEASE Ans: ...Are u there still? Please, answer meeeeeeeee , answer me , answer me... Please Let me know if any1 finds any error... Thanks. |
My algo is right but wa1 (on sample I have right answer). Where is mistake? | IlushaMax | 1601. AntiCAPS | 1 May 2016 17:15 | 1 |
I found hah) Edited by author 01.05.2016 17:16 |
WA9 WHY??? | romanula | 1601. AntiCAPS | 29 Apr 2016 12:34 | 5 |
new one but still WA9 package banky; import java.util.*; public class test1 { private static Scanner scan; public static void main(String [] args){ scan = new Scanner(System.in); int k=0; int r=0; int pr=0; while (scan.hasNext()){ String s = scan.nextLine(); //s = s.toUpperCase(); s = s.toLowerCase(); char c [] = s.toCharArray(); if (k<=0||r>0) c[0] -= 32; int i ; for(i=1;i<s.length();i++){ if ((c[i] == 46) || (c[i] == 33) || (c[i] == 63)) {pr= 1; c[i]=c[i];} else if (pr==1&&c[i]!=32) { c[i] -= 'a' - 'A'; pr = 0;}} for(i=0;i<s.length();i++){ if ((c[i] == 0)|| (c[i] == 14) || (c[i] == 1) || (c[i] == 31)) c[i] += 'a' - 'A';} for(i=1;i<s.length();i++){ if (((c[i-1]< 'a')&&(c[i-1]>='A'))&&((c[i]< 'a')&&(c[i]>='A'))) {c[i] += 'a' - 'A';}}
if ((c[s.length()-1] == 46) || (c[s.length()-1] == 33) || (c[s.length()-1] == 63)) {r=r+1;} else {r=0;} //System.out.println(k); //System.out.println(r); System.out.println(c); k=k+1; } } } Edited by author 30.04.2016 13:09 You are checking the only prev char for end of sentence. Why? Try "HERE!!! IS!!!!! TEST!!!!" P.S. Why "c[i]==32" better then "c[i]==' '"? Дякую, за тест. І що мені робити? :( Edited by author 29.04.2016 11:37 Implement state machine, ~2 states: 1) "at sentence begin", if char is alpha then it uppercased, state switched to "inside sentence" 2) "inside sentence", if char is alpha it lowercased; if char is ".?!" state switched to "at sentence begin". Thank you for help. But I am only beginer in java so i cant jet deal with this state machine Implement state machine, ~2 states: 1) "at sentence begin", if char is alpha then it uppercased, state switched to "inside sentence" 2) "inside sentence", if char is alpha it lowercased; if char is ".?!" state switched to "at sentence begin". |
Help me. Why Output limit exceeded in test #1 | ThanhKa_HCMUS | 1601. AntiCAPS | 8 Aug 2015 06:23 | 1 |
Code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Globalization; namespace _1601AntiCAPS { class Program { static void Main(string[] args) { string input = Console.In.ReadToEnd(); //string input; while (input != null) { Console.Write(input[0]); for (int i = 1; i < input.Length; i++) { if (input[i] >= 'A' && input[i] <= 'Z') { int c = Convert.ToInt32(input[i]); char character = (char)(c + 32); string text = character.ToString(); Console.Write(text); } else Console.Write(input[i]); } } } } } |
WA #11 | wxy | 1601. AntiCAPS | 14 Mar 2015 14:23 | 2 |
What may it be? i've try any test i can think and any test in other discussins,but still WA #11. I tested : ------- WHAT ARE YOU DOING? - I AM EATING. - really? -Yes,(new line) REALLY! - ok, i KNOW. i TRUST YOU. ------- and my program output : ------- What are you doing? - I am eating. - Really? -Yes, really! - Ok, i know. I trust you. ------- I don't know what's wrong, help, please. Re: WA #11 Who calls the Dragon Knight? *_* 14 Mar 2015 14:23 It must be "i trust you." not "I trust you" |