Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- const char duom[] = "Duomenys.txt";
- const char rez[] = "Rezultatai.txt";
- int perskaitys_per_dienu(int n, const int a, const int b) {
- int dienos = 0;
- while( n > 0 )
- n -= a + (b * dienos++);
- return dienos;
- }
- int main() {
- int n, a, b;
- ifstream in(duom);
- ofstream out(rez);
- while( in >> n >> a >> b )
- out << perskaitys_per_dienu(n, a, b) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment