了解了基本的C语言文件IO之后
我们来顺带结合下现实实际情况
我们经常在电脑上操作ctrl+c ctrl+v操作
在C语言中我们怎么复制文件呢?
我们可以这样子:
#include “stdio.h”
main()
最近看到很多關于使用C語言進行文件IO的操作題目
並且有很多是涉及到IO之後數據操作的
那我們就來說說C語言在文件的IO操作吧
我們先從最簡單的入手好了
我們先看一段很簡短的代碼 (閱讀全文…)
有這麽道題目:在自動販賣機裏賣巧克力派,1塊錢一個,每個巧克力派裏面都有一張優惠卷,湊夠7個優惠卷換一個巧克力派,問N塊錢,可以買+換多少巧克力派,並剩下幾張優惠卷。
例如:
輸入:20
輸出:巧克力:23 優惠卷:2
程序代碼如下: (閱讀全文…)
也是一道AC比較高的
感覺最近只對簡單題有feel?
盯著難題看了很久我只是想到了夜宵。。
Time Limit: 1 Second Memory Limit: 32768 KB
Given an positive integer A (1 <= A <= 100), output the lowest bit of A. For example, given A = 26, we can write A in binary form as 11010, so the lowest bit of A is 10, so the output should be 2. Another example goes like this: given A = 88, we can write A in binary form as 1011000, so the lowest bit of A is 1000, so the output should be 8. (閱讀全文…)
其實算是簡單題吧
用組數模擬下就出來了- –
哈。
The Drunk Jailer
Time Limit: 1 Second Memory Limit: 32768 KB
A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked.
One night, the jailer gets bored and decides to play a game. For round 1 of the game, he takes a drink of whiskey, and then runs down the hall unlocking each cell. For round 2, he takes a drink of whiskey, and then runs down the hall locking every other cell (cells 2, 4, 6, …). For round 3, he takes a drink of whiskey, and then runs down the hall. He visits every third cell (cells 3, 6, 9, …). If the cell is locked, he unlocks it; if it is unlocked, he locks it. He repeats this for n rounds, takes a final drink, and passes out.
(閱讀全文…)