Submission #2720457


Source Code Expand

Copy
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main(){
	string s; cin >> s; int a = 0, b = 0;
	stringstream ss; ss << s; ss >> a;
	Rep(i, s.length()){
		b += s[i] - '0';
	}
	if(a % b == 0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Submission Info

Submission Time
Task B - Digit Sums
User niimi
Language C++14 (GCC 5.4.1)
Score 200
Code Size 753 Byte
Status
Exec Time 1 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt, sample3.txt
All 200 / 200 sample1.txt, sample2.txt, sample3.txt, 1.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt 1 ms 256 KB
2.txt 1 ms 256 KB
3.txt 1 ms 256 KB
4.txt 1 ms 256 KB
5.txt 1 ms 256 KB
6.txt 1 ms 256 KB
7.txt 1 ms 256 KB
8.txt 1 ms 256 KB
sample1.txt 1 ms 256 KB
sample2.txt 1 ms 256 KB
sample3.txt 1 ms 256 KB