P2303 [SDOI2012] Longge 的問題(尤拉函式,推式子)
阿新 • • 發佈:2020-12-16
程式碼:
#include <stdio.h> char varChar1 = 0x11; int varInt1 = 0x12345678; short varShort1 = 0x2323; long long var64Int1 = 0xF1AAAAAAAAAAAAF2; long long main(int argc, char **argv) { long long var64Int2; var64Int2 = var64Int1 + varShort1 + varChar1; for(int i = 0; i < argc; i++){ printf("%s\n", *(argv + i)); } return var64Int2; } #include <stdlib.h> int var1; int var2 = 100; int var3; int var4 = 200; int func(int inVar1, int inVar2){ var3 = inVar1 + var4;int tmp = var3 * inVar2; return tmp; } int main(int argc, char **argv) { int *buffer; int var1 = func(var2, 5); buffer = (int *)malloc(1024); return var1; } #include <stdio.h> int arr[8] = {0, 1, 2, 3, 4, 5, 6, 7}; typedef struct _myStruct{ char ch1; doubledou1; int i1; } MyStruct; typedef union _myUnion{ char ch1; double dou1; int i1; } MyUnion; int main(int argc, char **argv) { MyStruct myStruct; myStruct.ch1 = 'a'; myStruct.dou1 = 1.0; myStruct.i1 = 2; MyUnion myUnion; myUnion.ch1 = 'a'; myUnion.dou1 = 1.0; myUnion.i1 = 2; printf("arr size: %d\n", sizeof(arr)); printf("struct size: %d\n", sizeof(MyStruct)); printf("union size: %d\n", sizeof(MyUnion)); return 0; } #include <stdio.h> int funSum(int num){ int sum = 0; for(int i = 0; i < num; i++){ sum += i; } return sum; } int main(int argc, char **argv) { long result = 0; for(int i = 0; i <= 100; i++){ result += i; } char arr[10] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'}; printf("result[1-100] = %d\n", result); printf("result[1-200] = %d\n", funSum(200)); return 0; }