|
|
Общий форум#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ char encrypted[100],desencriptado; int largo, resta; scanf("%s",encrypted); largo=strlen(encrypted); for(int j=0;j<largo;j++){ encrypted[j]-= 97; } encrypted[0]+=26; for(int i=1;i<largo;i++){ while(encrypted[i]<encrypted[i-1]){ encrypted[i]+=26; } } resta=5; for(int n=0;n<largo;n++){ desencriptado=((encrypted[n]-resta)%26)+97; printf("%c", desencriptado); resta=encrypted[n]; } return 0; } I keep getting WA8 but I don't have any test cases that may go wrong. Please help. Notice, that you can move duons alongside diagonal (A->F, A->H, G->E, ...) My solution is O(n^3T),and how to solve it faster? Answer is a - b - c or a - b * c Is this answer after sort? using System; using System.Collections.Generic; namespace Order { class Banknotes { public long value = 0; public int count = 0; public Banknotes(long value) { this.value = value; } } class Program { public static Banknotes FindMaxValue (List<Banknotes> list) { int _maxValue = list[0].count; Banknotes _maxBanknote = list[0]; for (int index = 1; index < list.Count; index++) { if (list[index].count > _maxValue) { _maxBanknote = list[index]; _maxValue = list[index].count; } } return _maxBanknote; } public static void Main (string[] args) { List<Banknotes> banknotes = new List<Banknotes>(); int length = Convert.ToInt32(Console.ReadLine()); if (length == 0) return; banknotes.Add(new Banknotes(Convert.ToInt64(Console.ReadLine()))); banknotes[0].count = 1; for (int iterable = 1; iterable < length; iterable++) { long number = Convert.ToInt64(Console.ReadLine()); for (int jterable = 0; jterable < banknotes.Count; jterable++) { // Console.WriteLine($"{number} is {numbers[jterable].value}?"); if (number == banknotes[jterable].value) { banknotes[jterable].count++; // Console.WriteLine("yes"); break; } else if (jterable + 1 == banknotes.Count) { // Console.WriteLine("no"); banknotes.Add(new Banknotes(number)); } } } Console.WriteLine(FindMaxValue(banknotes).value); } } } pls give me some tests,i don't know,what's wrong with my code #include<iostream> #define endl '\n' #define ll long long # define ld long double using namespace std; ll d[1100][1100]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef LOCAL freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif // LOCALfr int n,m; for (int i=1;i<=1000;i++) { for (int j=1;j<=1000;j++) { d[i][j] = d[i][j-1] + d[i - 1][j - 1] + 1; } } n=1;m=1; while (n && m) { cin>>n>>m; if (n &&m) { int l=1,r=m+1000,mi; while (l<r) { mi=(l+r)/2; if (d[n][mi]>=m) { r=mi; } else l=mi+1; } cout<<l<<endl; } } return 0; } Edited by author 03.11.2021 00:01 Edited by author 03.11.2021 00:01 Edited by author 03.11.2021 00:01 Here are some tests that helped me figure out what was wrong with my program: 316496 out => 317559 317560 318533 out => 318659 318660 945999 out => 950509 950510 055099 out => 055109 055110 00510059 out => 00504999 00505000 00450010 out => 00460019 00460020 00504010 out => 00504999 00505000 0019 out => 4509 4510 00510059 out => 00510059 00510060 945999 out => 950509 950510 008359 out => 009449 009450 3000 out => 4509 4510 4509 out => 4509 4510 4099 out => 4509 4510 9999 out => No solution 373730020389 out => 373730021389 373730021390 373730030290 out => 373730031289 373730031290 373730030289 out => 373730031289 373730031290 Good luck! 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 N = input().split() res = int(N[0]) * int(N[1]) * int(N[2]) * 2 NVM... forgot to use print Edited by author 01.11.2021 23:13 Try this 4 a b c a p d b e w b t y ans:2 / Edited by author 01.11.2021 14:38 / Edited by author 01.11.2021 14:38 просто while() и проверка на prime() а насчет доказательства не знаю, но существует утверждение о том, что любое чётное число, начиная с 4, можно представить в виде суммы двух простых чисел. ( Проблема Гольдбаха ). Хотя пока она не доказана. Но В 1966 году Чэнь Цзинжунь доказал, что любое достаточно большое чётное число представимо или в виде суммы двух простых чисел, или же в виде суммы простого числа и полупростого This is an example of how you shouldn't make the problem using System; namespace EasyHack_ { class Coder { private short[] unicode; private string word; public static readonly string alphabet = "abcdefghijklmnopqrstuvwxyz"; public string GetCoderWord() { this.UnicodeToCoder(); this.SetUnicode(); return this.word; } public string GetOutCoderWord() { this.UnicodeOutCoder(); this.SetUnicode(); return this.word; } public Coder(string word) { this.word = word.ToLower(); this.unicode = new short[word.Length]; this.GetUnicode(); }
public string GetWord () { return this.word; } public short[] GetWordUnicode () { return this.unicode; } private void GetUnicode () { for (int iterable = 0; iterable < unicode.Length; iterable++) { this.unicode[iterable] = (short)Coder.alphabet.IndexOf(this.word[iterable]); } } private void SetUnicode () { this.word = ""; for (int iterable = 0; iterable < unicode.Length; iterable++) { this.word += Coder.alphabet[unicode[iterable]]; } } private void UnicodeToCoder () { if (unicode[0] == 21) unicode[0] = 0; else this.unicode[0] = (this.unicode[0] + 5 > 25) ? (short)(this.unicode[0] + 5 - 25) : (short)(this.unicode[0] + 5); for (int iterable = 1; iterable < this.unicode.Length; iterable++) { this.unicode[iterable] = (this.unicode[iterable] + this.unicode[iterable - 1] > 25) ? (short)((this.unicode[iterable] + this.unicode[iterable - 1]) % 26) : (short)(this.unicode[iterable] + this.unicode[iterable - 1]); } } private void UnicodeOutCoder () { for (int iterable = 1; iterable < this.unicode.Length; iterable++) { while (this.unicode[iterable] < this.unicode[iterable - 1]) this.unicode[iterable] += 26; } short _lastUnicode = this.unicode[0]; if (this.unicode[0] == 0) this.unicode[0] = 21; else this.unicode[0] = (this.unicode[0] - 5 < 0) ? (short)(25 + this.unicode[0] - 5) : (short)(this.unicode[0] - 5); for (int iterable = 0; iterable < this.unicode.Length - 1; iterable++) { short element = this.unicode[iterable + 1]; this.unicode[iterable + 1] -= _lastUnicode; _lastUnicode = element; } } } class Program { public static void Main(string[] args) { string coderWord = Console.ReadLine(); Coder word = new Coder(coderWord); Console.WriteLine(word.GetOutCoderWord()); } } } Edited by author 31.10.2021 14:59 Edited by author 31.10.2021 15:11 in this test the footspeed is lower than one. sorry for my poor english. GOOD LUCK!!! What does this actually mean? I think it doesn't change anything! (speed < 1 but more that 0) Even I found that footseed is 0.5 in test 7. But what then? It doesn't change my solution and i can not understand if it actually does... :( and speed of underground is 50 in test 7 and some of the coordinates are in scientific notation, I mean it looks like 6.000000e-14 Edited by author 31.10.2021 02:32 Use Fenwick tree instead of segment tree |
|
|