Editorial for Bedao Regular Contest 07 - NUMBER
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Ta thấy rằng một số chia hết cho ~2~ có dạng là ~2n~.
Ta lại thấy tổng các chữ số chia hết cho ~9~ cũng chính là số đó chia hết cho ~9~, hay nói cách khác những số dạng ~9n~ là bội của ~9~.
Từ hai điều trên, một số chia hết cho ~2~ và chia hết cho ~9~ chính là số có dạng ~18n~.
Code mẫu
#include <bits/stdc++.h> #define int long long #define ii pair<int,int> #define st first #define nd second using namespace std; const int MOD = 1e9 + 7; void program(){ int n; cin >> n; cout << 18 * n << endl; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int test = 1; while (test --> 0){ program(); } }
Comments