This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.*; | |
| import java.awt.event.*; | |
| import java.awt.geom.*; | |
| import javax.swing.*; | |
| public class Wave extends JFrame { | |
| int w = 50; | |
| int h = 50; | |
| double[][] height; | |
| double[][] speed; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Array | |
| def flatten(dep=-1,ary=[]) | |
| each{|i|Array===i&&dep!=0?i.flatten(dep-1,ary):ary<<i} | |
| ary | |
| end | |
| end | |
| p [[1],[[2]],3,[4]].flatten(-1) | |
| p [[1],[[2]],3,[4]].flatten(0) | |
| p [[1],[[2]],3,[4]].flatten(1) | |
| p [[1],[[2]],3,[4]].flatten(2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <algorithm> | |
| #include <vector> | |
| using namespace std; | |
| int main(int argc, char **argv) { | |
| for(int kk = 1; ; kk++) { | |
| int marbs[7]; | |
| int sum = 0; | |
| for(int i = 1; i <= 6; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <cstring> | |
| using namespace std; | |
| int dp[7][60001]; | |
| int main(int argc, char **argv) { | |
| for(int k = 1; ; k++) { | |
| int sum = 0; | |
| memset(dp, -1, sizeof(dp)); | |
| dp[0][0]=0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| class Sora { | |
| const char *name; | |
| int num; | |
| public: | |
| Sora() : name("ソラ"), num(0) {} | |
| const Sora& operator--() {num++;return *this;} | |
| const Sora& operator++() {num++;return *this;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(void) { | |
| double s=0,c=1; | |
| int i,j; | |
| for(i = 0; i < 100; i++) { | |
| double ns=(s*60+c*11)/61; | |
| double nc=(c*60-s*11)/61; | |
| for(j = 0; j < ns*30+30; j++) { | |
| putchar(' '); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <cmath> | |
| #include <cstring> | |
| #include <algorithm> | |
| #include <vector> | |
| using namespace std; | |
| int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, | |
| 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, | |
| 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "json.h" | |
| static QVariant readJSONArray(QTextStream &in); | |
| static QVariant readJSONObject(QTextStream &in); | |
| inline int fromHexChar(int ch) { | |
| return (ch<='9') ? ch-'0' : (ch<='Z') ? ch+(10-'A') : ch+(10-'a'); | |
| } | |
| static QString readJSONString(QTextStream &in) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <cstring> | |
| using namespace std; | |
| int getat(const vector<int> &a, int x) { | |
| return (x<0||x>=(int)a.size()) ? 0 : a[x]; | |
| } | |
| int &getrat(vector<int> &a, int x) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <algorithm> | |
| #include <vector> | |
| #include <cstring> | |
| using namespace std; | |
| struct Rect { | |
| int x1,y1,x2,y2; | |
| }; |