Skip to content

Instantly share code, notes, and snippets.

View henrybear327's full-sized avatar

Chun-Hung Tseng henrybear327

View GitHub Profile
@henrybear327
henrybear327 / w1c idea
Last active August 29, 2015 14:16
w1c idea
開一個陣列紀錄出現過的餘數
過程大概是如此
1.先歸零
data [0] [1] [2] [3] [4] [5] [6]...
值 0 0 0 0 0 0 0 ...
2.每次計算餘數,就順便記錄下來
比如1/7的餘數出現順序為 3 2 6 4 5 1 3 2 6 4 5 1......(或是1 3 2 6 4 5,看你的演算法怎麼設計)
@henrybear327
henrybear327 / w2c.c
Created March 6, 2015 05:15
w2c(感謝黃鈺程).c
#include <stdio.h>
#include <string.h>
int main()
{
int test_cases;
scanf("%d", &test_cases);
while(test_cases--) {
long long int x, y, N;
scanf("%lld %lld %lld", &x, &y, &N);
@henrybear327
henrybear327 / w2c(new with help from stack overflow).c
Created March 5, 2015 18:47
w2c(new with help from stack overflow).c
#include <stdio.h>
int main()
{
int test_cases;
while(scanf("%d", &test_cases) != EOF) {
while(test_cases--) {
int x, y, N;
scanf("%d %d %d", &x, &y, &N);
if(x <= 0 || y <= 0 || N <= 0 || N > 10000)
@henrybear327
henrybear327 / w2c(old).c
Created March 5, 2015 18:47
w2c(old).c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int test_cases, count = 1;
while(scanf("%d", &test_cases) != EOF) {
while(test_cases--) {
long long int x, y, N;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int input_1, input_2;
while(scanf("%d %d", &input_1, &input_2) != EOF) {
int i, input_1_array[2]= {0}, input_2_array[7] = {0};
for(i = 1; i >= 0; i--) {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int test_cases;
while(scanf("%d", &test_cases) != EOF) {
while(test_cases--) {
int total_input;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int test_cases;
while(scanf("%d", &test_cases) != EOF) {
while(test_cases--) {
int x, y;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int cube_power(int);
int main()
{
int data[6];
while(scanf("%d%d%d%d%d%d", &data[0], &data[1], &data[2], &data[3], &data[4], &data[5]) != EOF) {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int data[6];
while(scanf("%d%d%d%d%d%d", &data[0], &data[1], &data[2], &data[3], &data[4], &data[5]) != EOF) {
int i;
for(i = 5; i >= 0; i--)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int data[100000 + 1];
int main()
{
int p, q;
while(scanf("%d %d", &p, &q) != EOF && q) {