Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

ICPC Mansoura Training lvl0 Contest #2 — Newcomers'23

Правка en5, от nabil_salah, 2023-03-13 21:48:20

A. In Search of an Easy Problem

As the name suggest it is an easy problem all what is needed is to take a string s as input and print Mohamed Salah

#include<iostream>
using namespace std;
int main()
{
 string str;cin>>str;
 cout<<"Mohamed Salah";
}

F. N and T

In this problem we want to find a number that is divisible by t and has n digits. But we found a series of problems:

  1. n can be 100 -> there is no data type that handles such a big number (long long take up to pow(2,64))

  2. How can I easily get a number divisible by t

The answer is t itself and

what about multiplying the number by 10 until I get the desired length? why 10: multiplying by 10 will keep the divisibility state (2x10 is divisible by 2 and 2x10x10 is still divisible by 2....)

so the answer will be the t multiplied by 10 until I reach the desired length. -> problem 2 solved

multiplying by 10 means adding 0 to the end of the number (2x10 = 20, 330x10 = 3300)

so we can print the t followed by zeros -> problem 1 solved

but when I will print -1? the answer is if the number of digits in t is less than n as the smallest number is divisble by t is t itself

#include <iostream>
#include <vector>
using namespace std ;
int32_t main() {
    int n,t;cin>>n>>t;
    if(t == 10 && n== 1){
        cout<<"-1";
    }else{
        cout<<t;
        n--;
        if(t == 10)n--;
        for (int i = 0; i < n; ++i) {
            cout<<"0";
        }
    }
}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en34 Английский nabil_salah 2023-03-16 01:02:16 0 (published)
en33 Английский Eman_Abdelhaleem 2023-03-15 01:59:14 35 Tiny change: ' $0$.\n\n</spoi' -> ' $0$.\n\n<B>Time Complexity :</B> $O(N)$\n\n</spoi'
en32 Английский Eman_Abdelhaleem 2023-03-15 01:57:35 10 Tiny change: 'follows)\nSurely, ' -> 'follows)\n\nSurely, '
en31 Английский Eman_Abdelhaleem 2023-03-15 01:48:08 1658
en30 Английский nabil_salah 2023-03-15 00:44:28 194 Tiny change: 'h"_** \n\n-_**Time Co' -> 'h"_** \n\n_**Time Co'
en29 Английский AyaHazem61 2023-03-15 00:11:54 6 Tiny change: ' elements in odd indices.\nthen we com' -> ' elements at odd indices.\nThen we com'
en28 Английский AyaHazem61 2023-03-15 00:10:38 851
en27 Английский AyaHazem61 2023-03-14 23:48:36 2 Tiny change: '">\n```C++#include <' -> '">\n```C++\n#include <'
en26 Английский AyaHazem61 2023-03-14 23:47:28 7
en25 Английский AyaHazem61 2023-03-14 23:46:10 16
en24 Английский AyaHazem61 2023-03-14 23:44:57 733
en23 Английский AbdelhakiemOsama 2023-03-14 23:43:28 60
en22 Английский AbdelhakiemOsama 2023-03-14 23:40:20 45
en21 Английский AbdelhakiemOsama 2023-03-14 23:35:43 805
en20 Английский AyaHazem61 2023-03-14 23:30:32 464
en19 Английский nabil_salah 2023-03-14 23:11:00 99
en18 Английский khaled-waleed 2023-03-14 23:05:17 206
en17 Английский khaled-waleed 2023-03-14 22:55:59 293
en16 Английский khaled-waleed 2023-03-14 22:08:10 2 Tiny change: ' follows\n1. Sort ' -> ' follows\n\n1. Sort '
en15 Английский khaled-waleed 2023-03-14 22:07:41 1806
en14 Английский khaled-waleed 2023-03-14 21:41:44 39
en13 Английский khaled-waleed 2023-03-14 21:40:34 14
en12 Английский khaled-waleed 2023-03-14 21:39:16 0 Tiny change: '-1, j-1)\n- bottom rig' -> '-1, j-1)\nbottom rig'
en11 Английский khaled-waleed 2023-03-14 21:37:28 2556
en10 Английский Eman_Abdelhaleem 2023-03-14 16:29:34 9
en9 Английский Eman_Abdelhaleem 2023-03-14 16:28:15 16 Tiny change: 'lution">\n\n</spoile' -> 'lution">\nNot finished yet\n</spoile'
en8 Английский Eman_Abdelhaleem 2023-03-14 16:24:26 181 Tiny change: 'on">\nIf $a%b=0$ ($a$ is ' -> 'on">\nIf $ a%b=0 $ ($a$ is '
en7 Английский Eman_Abdelhaleem 2023-03-14 15:59:30 1242
en6 Английский Eman_Abdelhaleem 2023-03-14 15:43:15 210
en5 Английский nabil_salah 2023-03-13 21:48:20 1398 Tiny change: ' **_t_**\nThe answ' -> ' **_t_**\n\nThe answ'
en4 Английский nabil_salah 2023-03-13 02:14:06 11
en3 Английский nabil_salah 2023-03-13 02:12:43 256 Making first prob editorial
en2 Английский nabil_salah 2023-03-13 02:04:19 2
en1 Английский nabil_salah 2023-03-13 01:58:29 171 Initial revision (saved to drafts)