fork download
  1. /*
  2.  
  3.   ███████████ █████ █████████ █████
  4. ░░███░░░░░███ ░░███ ███░░░░░███ ░░███
  5.  ░███ ░███ ██████ █████ ███████ ███ ░░░ ██████ ███████ ██████ ████████
  6.  ░██████████ ███░░███ ███░░ ░░░███░ ░███ ███░░███ ███░░███ ███░░███░░███░░███
  7.  ░███░░░░░███░███████ ░░█████ ░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░░░
  8.  ░███ ░███░███░░░ ░░░░███ ░███ ███░░███ ███░███ ░███░███ ░███ ░███░░░ ░███
  9.  ███████████ ░░██████ ██████ ░░█████ ░░█████████ ░░██████ ░░████████░░██████ █████
  10. ░░░░░░░░░░░ ░░░░░░ ░░░░░░ ░░░░░ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░
  11.  
  12.  
  13.  
  14. ░░░░░ ░░░░ ░░░░░░░░░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░ ░░░░░░░░░░ ░░░░░░ ░░░░░ ░░░░░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░░░░ ░░░░░
  15. */
  16.  
  17.  
  18.  
  19. #include <assert.h>
  20. #include <stdio.h>
  21.  
  22. #include <algorithm>
  23. #include <iostream>
  24. #include <vector>
  25. using namespace std;
  26.  
  27. #define long long long
  28.  
  29. typedef vector<int> vi;
  30. const int BASE = 10000;
  31.  
  32. void fix(vi &a) {
  33. a.push_back(0);
  34. for (int i = 0; i < a.size() - 1; ++i) {
  35. a[i + 1] += a[i] / BASE;
  36. a[i] %= BASE;
  37. if (a[i] < 0) {
  38. a[i] += BASE;
  39. a[i + 1]--;
  40. }
  41. }
  42. while (a.size() >= 2 && a.back() == 0) a.pop_back();
  43. }
  44.  
  45. vi operator*(const vi &a, const vi &b) {
  46. vi c(a.size() + b.size() + 1);
  47. for (int i = 0; i < a.size(); ++i)
  48. for (int j = 0; j < b.size(); ++j) {
  49. c[i + j] += a[i] * b[j];
  50. c[i + j + 1] += c[i + j] / BASE;
  51. c[i + j] %= BASE;
  52. }
  53. return fix(c), c;
  54. }
  55.  
  56. vi to_vi(int x) { // x < Base
  57. assert(x < BASE);
  58. return vi(1, x);
  59. }
  60.  
  61. vi operator+(vi a, const vi &b) {
  62. a.resize(max(a.size(), b.size()));
  63. for (int i = 0; i < b.size(); ++i)
  64. a[i] += b[i];
  65. return fix(a), a;
  66. }
  67. vi operator-(vi a, const vi &b) {
  68. for (int i = 0; i < b.size(); ++i)
  69. a[i] -= b[i];
  70. return fix(a), a;
  71. }
  72. vi operator*(vi a, int x) { // x < BASE
  73. assert(x < BASE);
  74. for (int i = 0; i < a.size(); ++i)
  75. a[i] *= x;
  76. return fix(a), a;
  77. }
  78.  
  79. bool operator<(const vi &a, const vi &b) {
  80. if (a.size() != b.size()) return a.size() < b.size();
  81. for (int i = a.size() - 1; i >= 0; i--)
  82. if (a[i] != b[i])
  83. return a[i] < b[i];
  84. return false;
  85. }
  86.  
  87. vi operator/(vi a, int x) { // x < BASE
  88. assert(x < BASE);
  89. for (int i = (int)a.size() - 1, r = 0; i >= 0; --i, r %= x) {
  90. r = r * BASE + a[i];
  91. a[i] = r / x;
  92. }
  93. return fix(a), a;
  94. }
  95. int operator%(const vi &a, int x) { //x < BASE
  96. int r = 0;
  97. for (int i = (int)a.size() - 1; i >= 0; --i)
  98. r = (r * BASE + a[i]) % x;
  99. return r;
  100. }
  101.  
  102. istream &operator>>(istream &cin, vi &a) {
  103. string s;
  104. cin >> s;
  105. a.clear();
  106. a.resize(s.size() / 4 + 1);
  107. for (int i = 0; i < s.size(); ++i)
  108. {
  109. int x = (s.size() - 1 - i) / 4; // <- log10(BASE)=4
  110. a[x] = a[x] * 10 + (s[i] - '0');
  111. }
  112. return fix(a), cin;
  113. }
  114.  
  115. ostream &operator<<(ostream &cout, const vi &a) {
  116. printf("%d", a.back());
  117. for (int i = (int)a.size() - 2; i >= 0; i--)
  118. printf("%04d", a[i]);
  119. return cout;
  120. }
  121.  
  122. void test_fib(int n) {
  123. vi a = to_vi(1), b = to_vi(1);
  124. for (int i = 1; i <= n / 2; ++i)
  125. {
  126. a = a + b;
  127. b = b + a;
  128. cout << "F[" << i * 2 + 1 << "]=" << a << endl;
  129. cout << "F[" << i * 2 + 2 << "]=" << b << endl;
  130. }
  131. }
  132.  
  133. void test_fact(int n)
  134. {
  135. vi P = to_vi(1);
  136. for (int i = 1; i <= n; ++i) {
  137. P = P * i;
  138. cout << i << "!= " << P << endl;
  139. }
  140. }
  141.  
  142. void test_divide()
  143. {
  144. vi a;
  145. int x;
  146. for (;;) {
  147. cout << "Input a big integer and a small integer (<10000)" << endl;
  148. if (cin >> a >> x)
  149. ;
  150. else
  151. break;
  152. cout << "a=" << a << " x=" << x << endl;
  153. vi q = a / x;
  154. int r = a % x;
  155. cout << "a/x=" << q << "; a%x=" << r << endl;
  156. vi a0 = q * to_vi(x) + to_vi(r);
  157. assert(a0 == a && !(a0 < a) && !(a0 > a));
  158. }
  159. }
  160.  
  161. int main()
  162. {
  163. vi a, b;
  164. cin >> a ;
  165. if ((a % 13)==0)
  166. {
  167. cout << "YES";
  168. }
  169. else cout << "NO";
  170. }
  171. {
  172. public static void main (String[] args) throws java.lang.Exception
  173. {
  174. // your code goes here
  175. }
  176. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:19: error: illegal character: '#'
#include <assert.h>
^
Main.java:19: error: class, interface, or enum expected
#include <assert.h>
         ^
Main.java:20: error: illegal character: '#'
#include <stdio.h>
^
Main.java:22: error: illegal character: '#'
#include <algorithm>
^
Main.java:23: error: illegal character: '#'
#include <iostream>
^
Main.java:24: error: illegal character: '#'
#include <vector>
^
Main.java:27: error: illegal character: '#'
#define long long long
^
Main.java:27: error: class, interface, or enum expected
#define long long long
        ^
Main.java:30: error: class, interface, or enum expected
const int BASE = 10000;
^
Main.java:32: error: class, interface, or enum expected
void fix(vi &a) {
^
Main.java:34: error: class, interface, or enum expected
    for (int i = 0; i < a.size() - 1; ++i) {
    ^
Main.java:34: error: class, interface, or enum expected
    for (int i = 0; i < a.size() - 1; ++i) {
                    ^
Main.java:34: error: class, interface, or enum expected
    for (int i = 0; i < a.size() - 1; ++i) {
                                      ^
Main.java:36: error: class, interface, or enum expected
        a[i] %= BASE;
        ^
Main.java:37: error: class, interface, or enum expected
        if (a[i] < 0) {
        ^
Main.java:39: error: class, interface, or enum expected
            a[i + 1]--;
            ^
Main.java:40: error: class, interface, or enum expected
        }
        ^
Main.java:43: error: class, interface, or enum expected
}
^
Main.java:47: error: class, interface, or enum expected
    for (int i = 0; i < a.size(); ++i)
    ^
Main.java:47: error: class, interface, or enum expected
    for (int i = 0; i < a.size(); ++i)
                    ^
Main.java:47: error: class, interface, or enum expected
    for (int i = 0; i < a.size(); ++i)
                                  ^
Main.java:48: error: class, interface, or enum expected
        for (int j = 0; j < b.size(); ++j) {
                        ^
Main.java:48: error: class, interface, or enum expected
        for (int j = 0; j < b.size(); ++j) {
                                      ^
Main.java:50: error: class, interface, or enum expected
            c[i + j + 1] += c[i + j] / BASE;
            ^
Main.java:51: error: class, interface, or enum expected
            c[i + j] %= BASE;
            ^
Main.java:52: error: class, interface, or enum expected
        }
        ^
Main.java:54: error: class, interface, or enum expected
}
^
Main.java:58: error: class, interface, or enum expected
    return vi(1, x);
    ^
Main.java:59: error: class, interface, or enum expected
}
^
Main.java:63: error: class, interface, or enum expected
    for (int i = 0; i < b.size(); ++i)
    ^
Main.java:63: error: class, interface, or enum expected
    for (int i = 0; i < b.size(); ++i)
                    ^
Main.java:63: error: class, interface, or enum expected
    for (int i = 0; i < b.size(); ++i)
                                  ^
Main.java:65: error: class, interface, or enum expected
    return fix(a), a;
    ^
Main.java:66: error: class, interface, or enum expected
}
^
Main.java:68: error: class, interface, or enum expected
    for (int i = 0; i < b.size(); ++i)
                    ^
Main.java:68: error: class, interface, or enum expected
    for (int i = 0; i < b.size(); ++i)
                                  ^
Main.java:70: error: class, interface, or enum expected
    return fix(a), a;
    ^
Main.java:71: error: class, interface, or enum expected
}
^
Main.java:74: error: class, interface, or enum expected
    for (int i = 0; i < a.size(); ++i)
    ^
Main.java:74: error: class, interface, or enum expected
    for (int i = 0; i < a.size(); ++i)
                    ^
Main.java:74: error: class, interface, or enum expected
    for (int i = 0; i < a.size(); ++i)
                                  ^
Main.java:76: error: class, interface, or enum expected
    return fix(a), a;
    ^
Main.java:77: error: class, interface, or enum expected
}
^
Main.java:81: error: class, interface, or enum expected
    for (int i = a.size() - 1; i >= 0; i--)
    ^
Main.java:81: error: class, interface, or enum expected
    for (int i = a.size() - 1; i >= 0; i--)
                               ^
Main.java:81: error: class, interface, or enum expected
    for (int i = a.size() - 1; i >= 0; i--)
                                       ^
Main.java:84: error: class, interface, or enum expected
    return false;
    ^
Main.java:85: error: class, interface, or enum expected
}
^
Main.java:89: error: class, interface, or enum expected
    for (int i = (int)a.size() - 1, r = 0; i >= 0; --i, r %= x) {
    ^
Main.java:89: error: class, interface, or enum expected
    for (int i = (int)a.size() - 1, r = 0; i >= 0; --i, r %= x) {
                                           ^
Main.java:89: error: class, interface, or enum expected
    for (int i = (int)a.size() - 1, r = 0; i >= 0; --i, r %= x) {
                                                   ^
Main.java:91: error: class, interface, or enum expected
        a[i] = r / x;
        ^
Main.java:92: error: class, interface, or enum expected
    }
    ^
Main.java:94: error: class, interface, or enum expected
}
^
Main.java:97: error: class, interface, or enum expected
    for (int i = (int)a.size() - 1; i >= 0; --i)
    ^
Main.java:97: error: class, interface, or enum expected
    for (int i = (int)a.size() - 1; i >= 0; --i)
                                    ^
Main.java:97: error: class, interface, or enum expected
    for (int i = (int)a.size() - 1; i >= 0; --i)
                                            ^
Main.java:99: error: class, interface, or enum expected
    return r;
    ^
Main.java:100: error: class, interface, or enum expected
}
^
Main.java:104: error: class, interface, or enum expected
    cin >> s;
    ^
Main.java:105: error: class, interface, or enum expected
    a.clear();
    ^
Main.java:106: error: class, interface, or enum expected
    a.resize(s.size() / 4 + 1);
    ^
Main.java:107: error: class, interface, or enum expected
    for (int i = 0; i < s.size(); ++i) 
    ^
Main.java:107: error: class, interface, or enum expected
    for (int i = 0; i < s.size(); ++i) 
                    ^
Main.java:107: error: class, interface, or enum expected
    for (int i = 0; i < s.size(); ++i) 
                                  ^
Main.java:110: error: class, interface, or enum expected
        a[x] = a[x] * 10 + (s[i] - '0');
        ^
Main.java:111: error: class, interface, or enum expected
    }
    ^
Main.java:113: error: class, interface, or enum expected
}
^
Main.java:117: error: class, interface, or enum expected
    for (int i = (int)a.size() - 2; i >= 0; i--)
    ^
Main.java:117: error: class, interface, or enum expected
    for (int i = (int)a.size() - 2; i >= 0; i--)
                                    ^
Main.java:117: error: class, interface, or enum expected
    for (int i = (int)a.size() - 2; i >= 0; i--)
                                            ^
Main.java:119: error: class, interface, or enum expected
    return cout;
    ^
Main.java:120: error: class, interface, or enum expected
}
^
Main.java:124: error: class, interface, or enum expected
    for (int i = 1; i <= n / 2; ++i) 
    ^
Main.java:124: error: class, interface, or enum expected
    for (int i = 1; i <= n / 2; ++i) 
                    ^
Main.java:124: error: class, interface, or enum expected
    for (int i = 1; i <= n / 2; ++i) 
                                ^
Main.java:127: error: class, interface, or enum expected
        b = b + a;
        ^
Main.java:128: error: class, interface, or enum expected
        cout << "F[" << i * 2 + 1 << "]=" << a << endl;
        ^
Main.java:129: error: class, interface, or enum expected
        cout << "F[" << i * 2 + 2 << "]=" << b << endl;
        ^
Main.java:130: error: class, interface, or enum expected
    }
    ^
Main.java:136: error: class, interface, or enum expected
    for (int i = 1; i <= n; ++i) {
    ^
Main.java:136: error: class, interface, or enum expected
    for (int i = 1; i <= n; ++i) {
                    ^
Main.java:136: error: class, interface, or enum expected
    for (int i = 1; i <= n; ++i) {
                            ^
Main.java:138: error: class, interface, or enum expected
        cout << i << "!= " << P << endl;
        ^
Main.java:139: error: class, interface, or enum expected
    }
    ^
Main.java:145: error: class, interface, or enum expected
    int x;
    ^
Main.java:146: error: class, interface, or enum expected
    for (;;) {
    ^
Main.java:146: error: class, interface, or enum expected
    for (;;) {
           ^
Main.java:148: error: class, interface, or enum expected
        if (cin >> a >> x)
        ^
Main.java:150: error: class, interface, or enum expected
        else
        ^
Main.java:152: error: class, interface, or enum expected
        cout << "a=" << a << " x=" << x << endl;
        ^
Main.java:153: error: class, interface, or enum expected
        vi q = a / x;
        ^
Main.java:154: error: class, interface, or enum expected
        int r = a % x;
        ^
Main.java:155: error: class, interface, or enum expected
        cout << "a/x=" << q << "; a%x=" << r << endl;
        ^
Main.java:156: error: class, interface, or enum expected
        vi a0 = q * to_vi(x) + to_vi(r);
        ^
Main.java:157: error: as of release 1.4, 'assert' is a keyword, and may not be used as an identifier
        assert(a0 == a && !(a0 < a) && !(a0 > a));
        ^
Main.java:158: error: class, interface, or enum expected
    }
    ^
Main.java:164: error: class, interface, or enum expected
    cin >> a ;
    ^
Main.java:165: error: class, interface, or enum expected
    if ((a % 13)==0)
    ^
Main.java:168: error: class, interface, or enum expected
    }
    ^
100 errors
stdout
Standard output is empty