Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int n;
- float V[2][30];
- int read_data()
- {
- ifstream fin("intrare.in");
- ofstream fout("iesire.out");
- fin>>n;
- for(int x = 1;x<=n;x++)
- {
- for(int y = 1;y<=2;y++)
- {
- fin>>V[y][x];
- }
- }
- }
- int compute_data()
- {
- float remain = 0;
- int time = 0;
- for(int x = 1;x<=n;x++)
- {
- remain = 0;
- time = 0;
- if(V[2][x]>=0.6)
- {
- remain=V[2][x];
- cout<<remain<<endl;
- cout<<remain-(0.6)<<endl;
- while(remain>0)
- {
- remain-=0.6;
- time++;
- }
- cout<<time<<" "<<remain;
- cout<<endl;
- V[2][x] = 1*time+remain;
- }
- }
- }
- int main()
- {
- read_data();
- compute_data();
- ///verificare
- for(int x = 1;x<=n;x++)
- {
- for(int y = 1;y<=2;y++)
- {
- cout<<V[y][x]<<" ";
- }
- cout<<endl;
- }
- ///----------
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement