Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#include
#include
#include
using namespace std; int main() { string s; cin >> s; int l = s.size(); int zbir = 0; for(int i = 0; i < l; i++) { zbir += (s[i] - '0'); } string najgolem = ""; for(int i = 0; i < l; i++) { int cifra = (s[i] - '0'); for(int j = 0; j <= 9; j++) { if(i == 0 and j != 0 and cifra != j) { int a1 = zbir - cifra; a1 += j; if(a1 % 3 == 0) { s[i] = (j + '0'); if(najgolem < s) { najgolem = s; } s[i] = (cifra + '0'); } } else if(cifra != j) { int a1 = zbir - cifra; a1 += j; if(a1 % 3 == 0) { s[i] = (j + '0'); if(najgolem < s) { najgolem = s; } s[i] = (cifra + '0'); } } } } cout << najgolem << endl; return 0; } // 999 // 899
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)