Submission #2607998


Source Code Expand

Copy
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"here"<<en
#define _out(value) cout<<"      "<<value<<en
#define out(value) cout<<value<<en

int main(){
  int n;
  cin>>n;
  
  bool e=false;
  int ans=0;
  for(int i=5; i>=0; i--){
    int mod=1;
    for(int j=0; j<i; j++){
      mod*=10;
    }
    int k=n/mod;
    if(k){
      if(n%mod==0&&i!=0){
        cout<<10<<en
        RE
      }
      e=true;
      ans+=k;
      n-=k*mod;
    }
  }
  
  if(e) out(ans)
  else out(10)
}

Submission Info

Submission Time
Task A - Digits Sum
User Kazu0714
Language C++14 (GCC 5.4.1)
Score 200
Code Size 1106 Byte
Status
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt
All 200 / 200 sample1.txt, sample2.txt, in1.txt, in10.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt 1 ms 256 KB
in10.txt 1 ms 256 KB
in2.txt 1 ms 256 KB
in3.txt 1 ms 256 KB
in4.txt 1 ms 256 KB
in5.txt 1 ms 256 KB
in6.txt 1 ms 256 KB
in7.txt 1 ms 256 KB
in8.txt 1 ms 256 KB
in9.txt 1 ms 256 KB
sample1.txt 1 ms 256 KB
sample2.txt 1 ms 256 KB