30252023-02-08 13:20:49bzsofiaSzámjegy keveréscpp11Wrong answer 6/403ms4172 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;

unsigned 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
SubtaskSumTestVerdictTimeMemory
base6/40
1Accepted0/03ms1876 KiB
2Accepted0/03ms2124 KiB
3Wrong answer0/03ms2340 KiB
4Accepted2/23ms2672 KiB
5Accepted2/23ms2916 KiB
6Accepted2/22ms3000 KiB
7Wrong answer0/23ms2964 KiB
8Wrong answer0/23ms3164 KiB
9Wrong answer0/23ms3244 KiB
10Wrong answer0/23ms3228 KiB
11Wrong answer0/43ms3344 KiB
12Wrong answer0/43ms3616 KiB
13Wrong answer0/23ms3776 KiB
14Wrong answer0/23ms3968 KiB
15Wrong answer0/23ms3980 KiB
16Wrong answer0/23ms4108 KiB
17Wrong answer0/23ms4100 KiB
18Wrong answer0/23ms4104 KiB
19Wrong answer0/33ms4108 KiB
20Wrong answer0/33ms4172 KiB