Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //B1 UBB2018
- #include <iostream>
- using namespace std;
- int conversie(char s[],int lung){
- if(lung==1){
- if(s[lung]>='A')
- return s[lung] - 'A' + 10;
- else
- return s[lung] - '0';
- }
- else{
- if(s[lung]>='A')
- return conversie(s,lung-1)*16+s[lung] - 'A' + 10;
- else
- return conversie(s,lung-1)*16+s[lung] - '0';
- }
- }
- int main() {
- char s[100];
- int lung=2;
- cin >>(s+1);
- cout<<conversie(s,lung);
- return 0;
- }
- ///b2 ubb 2018
- #include <iostream>
- using namespace std;
- void f(int a, int b, int x[], int &k) {
- int p = 1;
- k = 0;
- while(p * 10 + 1 <= a) {
- p = p * 10 + 1;
- }
- while(p <= b) {
- for(int c = 1; c <= 9; c++) {
- if(c * p >= a && c * p <= b) {
- k++;
- ///x[k] = c * p;
- cout << x[k] << ' ';
- }
- }
- p = p * 10 + 1;
- }
- ///cout << endl;
- }
- int main() {
- int a, b, x[1001] = {}, k;
- cin >> a >> b;
- f(a, b, x, k);
- for(int i = 1; i <= k; i++) {
- cout << x[i] << ' ';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement