30242023-02-08 13:14:52bzsofiaSzámjegy keveréscpp11Hibás válasz 6/403ms4068 KiB

// szamjegy keveres.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

long long szam, db;
string s;

int main()
{
	cin >> szam;

	while (szam!=0)
	{
		if (szam < 10)
		{
			db += szam;
			break;
		}
		else
		{
			++db;
			s = to_string(szam);

			sort(s.begin(), s.end());
			
			if (s[0] == '0')
			{
				s[0] = s[1];
				s[1] = '0';
			}

			szam = 0;
			for (char e : s)
			{
				szam = szam * 10 + (e - 48);
			}
			szam -= 1;
		}
	}

	cout << db;

	return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
RészfeladatÖsszpontTesztVerdiktIdőMemória
base6/40
1Elfogadva0/03ms1748 KiB
2Elfogadva0/03ms1988 KiB
3Hibás válasz0/03ms2200 KiB
4Elfogadva2/23ms2332 KiB
5Elfogadva2/23ms2556 KiB
6Elfogadva2/23ms2764 KiB
7Hibás válasz0/22ms2848 KiB
8Hibás válasz0/22ms2952 KiB
9Hibás válasz0/23ms2968 KiB
10Hibás válasz0/22ms3056 KiB
11Hibás válasz0/43ms3168 KiB
12Hibás válasz0/43ms3188 KiB
13Hibás válasz0/23ms3268 KiB
14Hibás válasz0/23ms3632 KiB
15Hibás válasz0/23ms3488 KiB
16Hibás válasz0/23ms3620 KiB
17Hibás válasz0/23ms3988 KiB
18Hibás válasz0/23ms4068 KiB
19Hibás válasz0/33ms4036 KiB
20Hibás válasz0/33ms4060 KiB