Entries from 2019-01-01 to 1 year
IN JAPANESE https://www.qoosky.io/techs/5cd1a59497
cin >> s; found = s.find("AB"); while(found != string::npos){ cnt++; found = s.find("AB", found+1); }
int main() { long n; cin >> n; long result = 0; for (long i=2; i<=sqrt(n); i++) { if (n%i==0) { if (i==(n/i)) result += i; else result += (i + n/i); } } cout << result << endl; }
I encountered this error in trying to implement comparative operator in my compiler. The error was solved by replacing "movzb" with "movzx".
program: stmt program program: ε stmt: "return" assign ";" stmt: assign ";" assign: equality assign: equality "=" assign equality: relational equality: equality "==" relational equality: equality "!=" relational relational: add relational:…
#include<vector> struct Unionfind { vector<int> par, rank, size; Unionfind(int n) : par(n), rank(n), size(n){ for(int i=0;i</int></vector>
I don't know how to deal with session with webapp. So I just add all past stacks as a string with delimiter /, and pass it to the template. test.py cursors = self.request.get('cursors') if cursors: list_cursors = cursors.split('/') query.w…
link (in Japanese) ifndef
Googleカレンダーで各カレンダーのカレンダーIDを知る方法 | スキコミ
from pickle import dump # save with open('sample.pickle', mode='wb') as f: pickle.dump('Hello, World!', f) #load with open('sample.pickle', mode='rb') as f: pickle.load(f) Thanks to this blog (in Japanese) Python: オブジェクトを漬物 (Pickl…
Since oauth2client library seems to be deprecated, OAuth2 credentials flow should be written with google-auth library recommended. from flask import redirect, session, url_for def credentials_to_dict(credentials): return { 'token': credent…
Normally, variables can be swapped with temporary variables. tmp = a a = b b = tmp In Python, with a tuple, a, b = b, a