package glass; import java.io.*; /** *Title:
*Description:
*Copyright: Copyright (c) 2004
*Company:
* @author LashaCoder * @version */ public class MainGlass { int n = 0; char array []; File in_file = new File("D:/java/glass/glasses.in"); RandomAccessFile in; public MainGlass() { operations(); } void operations(){ //loads the data try { in = new RandomAccessFile(in_file,"r"); n = Integer.parseInt(in.readLine()); array = in.readLine().toCharArray(); } catch (IOException ex) { }catch (NumberFormatException ex) { } //here`s the operations for(int i = 1; i < 11; i++){ for(int j = 0; j < n; j+=i){ if(array[j] == '1'){ array[j] = '0'; } else{ array[j] = '1'; } } } System.out.println(array); } public static void main(String[] args) { MainGlass mainGlass1 = new MainGlass(); }