9202022-01-28 10:43:53kidesoSzámjegy keveréscpp14Forditási hiba
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	string s;
	cin >> s;
	
	long long sum = 0;
	long long db = 0;
	for (char c : s){
		sum += long long(c - '0');
		if (c != '0') ++db;
	}

	if (db == 1 && s[0] != '1')
		sum += (s.length() - 1) * 9;

	cout << sum + s.length() * (s.length() - 1) / 2 * 9;
	return 0;
}
Forditási hiba
exit status 1main.cpp: In function ‘int main()’:
main.cpp:16:10: error: expected primary-expression before ‘long’
   16 |   sum += long long(c - '0');
      |          ^~~~
Exited with error status 1