Skip to content

Instantly share code, notes, and snippets.

View pinglunliao's full-sized avatar

pinglunliao pinglunliao

View GitHub Profile
#include <iostream>
using namespace std;
int main() {
short y;
while(cin >> y){
y = (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0);
cout << (y == 1?"閏年":"平年") << endl;
}
return 0;
#include <iostream>
using namespace std;
int main() {
short t;
cin >> t;
while(t-- > 0){
int a, b, c, d, e, r;
cin >> a >> b >> c >> d;
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a, b, c;
while( cin >> a >> b >> c )
#include <iostream>
using namespace std;
int main()
{
int k = -7;
char ch;
while( cin.get(ch) )
#include <iostream>
using namespace std;
int main()
{
unsigned short prime[] = {
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, 193, 197, 199,
211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293,
#include <iostream>
using namespace std;
short number(char c)
{
short num;
switch(c)
{
#include <iostream>
using namespace std;
int main()
{
const int SIZE = 100;
int matrix[SIZE][SIZE];
int row, col;
#include <iostream>
#include <cmath>
using namespace std;
const short SIZE = 9;
void prtMsg(bool b)
{
cout << (b?"yes":"no") << endl;
#include <iostream>
#include <string>
using namespace std;
void eatspaces(string &str); // Function to eliminate blanks
int expr(string &str); // Function evaluating an expression
int term(string &str, int& index); // Function analyzing a term
int number(string &str, int& index); // Function to recognize a number
string extract(string &str, int& index); //Function to extract a substring
#include <iostream>
using namespace std;
int main()
{
short encode[] = {
10, 11, 12, 13, 14, 15, 16, 17, 34,
18, 19, 20, 21, 22, 35, 23, 24, 25,
26, 27, 28, 29, 32, 30, 31, 33